LuisUrrutia / esbuild-plugin-handlebars

an esbuild plugin to handle ... handlebars!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

esbuild-plugin-handlebars

an esbuild plugin to handle ... handlebars!

Installation

yarn add -D esbuild-plugin-handlebars
# or
npm install -D esbuild-plugin-handlebars

Usage

const esbuild = require("esbuild");
const handlebarsPlugin = require("esbuild-plugin-handlebars");

esbuild
  .build({
    entryPoints: ["input.js"],
    outfile: "output.js",
    bundle: true,
    plugins: [handlebarsPlugin()],
  })
  .then((result) => console.log(result))
  .catch(() => process.exit(1));

You can also set additionalHelpers and precompileOptions:

const hbsOptions = {
  additionalHelpers: {},
  additionalPartials: {
    childTemplate: "./child.hbs",
  },
  precompileOptions: {},
};

// usual esbuild config
{
 ...
 plugins: [handlebarsPlugin(hbsOptions)],
 ...
}

About

an esbuild plugin to handle ... handlebars!


Languages

Language:TypeScript 71.5%Language:JavaScript 22.2%Language:Handlebars 6.3%