esbuild-plugin-hbs
is a plugin to generate HTML files through handlebars with esbuild.
Is anything missing, please please create a ticket
Requirements
...
Installation
yarn add -D esbuild-plugin-hbs
npm i --save-dev esbuild-plugin-hbs
Usage
You can set options in separate json files.
Some helpers are included out of the box. I will keep adding to the list.
You can use the json
helper like the following code to debug your data.
{{ json user }}
Under the hood esbuild-plugin-hbs
uses the jsdom lib.
â ď¸ This plugin tries to cover most cases, set as much as possible with little configuration. If you find that I have forgotten certain issues, please write a ticket
Sample configuration
const options: {
entryPoints: ['index.ts'],
bundle: true,
metafile: true,
outdir: 'dist/',
plugins: [
handlebarsPlugin({
views: 'views',
html: 'html',
public: 'public',
files: [
{
filename: 'single.hbs',
title: 'This is the Single file',
data: './single.json',
},
{
filename: 'about.html',
title: 'This is the about file',
data: './user.json',
},
]
}),
],
};
esbuild.build(options).catch(() => process.exit(1))
Sample json configuration
{
"title": "This is the single page",
"namespace": "single",
"insertScript": true,
"items": [{
"id": 1,
"first_name": "Kaila"
}, {
"id": 2,
"first_name": "Barrie"
}]
}
Contributing
Contributions are very welcome
Todos