Skip to content

Latest commit

 

History

History

parcel-reporter-mkpdf

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

npm

parcel-reporter-mkpdf

📦 Plugin for Parcel web build tool:

Each time parcel builds an HTML (either in serve/watch or production mode), this plugin will save it as a PDF. The exported PDF will look the same as if you had used the Print functionality from Chrome.

Key features:

  • 💫 Iterative development: your PDF is generated every time parcel finishes an HTML built.
  • 🎨 Style the PDFs with your CSS/Less/Sass.
  • 🚀 Fast "printing" of the PDFs thanks to internal caching. Your HTML linked external files (e.g. .js/.css) will be fetched only once.

Install package

Using npm:

npm install parcel-reporter-mkpdf --save-dev

Analogously, using yarn:

yarn add parcel-reporter-mkpdf --dev

How to use

To hook this plugin to parcel's builds, add this plugin name to the field reporters in your .parcelrc(https://parceljs.org/features/plugins/#.parcelrc) configuration; example:

{
  "extends": "@parcel/config-default",
  "reporters": [
    "...",
    "parcel-reporter-mkpdf"
  ]
}

As an alternative, use the --reporter option in parcel's CLI; example:

npx parcel serve --reporter parcel-reporter-mkpdf

That's all! From then on, each time parcel builds an HTML (e.g., dist/someFilename.html), the PDF will be generated in the same folder, with same filename but with changed file extension (i.e., dist/someFilename.pdf).