Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
tea-school
Advanced tools
Simplified HTML + CSS --> PDF
Generetor for Nodejs
Basically just a method combining PugJS, Node-Sass, and Puppeteer.
npm install tea-school
All the power you need resides in PugJs, Node-Sass and Puppeteer.
You have the documentation for each one of them, and you simply pass the same object of configuration.
For further inspection look at the example
folder
import {GeneratePdfOptions, generatePdf} from 'tea-school';
import * as path from 'path';
const options: GeneratePdfOptions = {
htmlTemplatePath: path.resolve(__dirname, 'pdf-template.pug'),
styleOptions: {
file: path.resolve(__dirname, 'pdf-template.scss')
},
htmlTemplateOptions: {
contextRelatedVar: 'Timothy'
},
pdfOptions: {
// Omit to get output as buffer solely
path: 'pdf-file.pdf',
format: 'A4',
printBackground: true
}
}
(async () => {
const pdfBuffer: Buffer = await generatePdf(options);
})();
style(type="text/css") #{compiledStyle}
div#banner-message
p Hello, #{name}
button My god, this is amazing
$blue: #0084ff;
$blue-darker: darken($blue, 5);
body {
background: #20262E;
padding: 20px;
font-family: Helvetica;
}
#banner-message {
background: #e0e0e0;
border-radius: 4px;
padding: 20px;
font-size: 25px;
text-align: center;
transition: all 0.2s;
margin: 0 auto;
width: 300px;
button {
background: $blue-darker;
border: none;
border-radius: 5px;
padding: 8px 14px;
font-size: 15px;
color: #fff;
}
}
The key compiledStyle
is reserved on the Pug options for the compiled style to be attached to the html.
Please do not use this key (or use at your own risk)
FAQs
A simplified html + css --> PDF generator
The npm package tea-school receives a total of 29 weekly downloads. As such, tea-school popularity was classified as not popular.
We found that tea-school demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.