JSPM

esbuild-plugin-hbs

0.0.7
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 117
    • Score
      100M100P100Q92294F
    • License MIT

    Package Exports

    • esbuild-plugin-hbs
    • esbuild-plugin-hbs/dist/index.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (esbuild-plugin-hbs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    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
    # or
    npm i --save-dev esbuild-plugin-hbs

    Usage

    You can set options in separate json files.

    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