parcel-reporter-mkpdf v1.1.0
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
parcelfinishes 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-devAnalogously, using yarn:
yarn add parcel-reporter-mkpdf --devHow 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-mkpdfThat'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).
Coding
Internally, the PDF is "printed" with Chromium as a headless browser. The browser is controlled with Google's puppeteer.
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago