esbuild-plugin-eta
v0.1.0
Published
esbuild plugin for Eta JS template
Downloads
37
Readme
esbuild-plugin-eta
An esbuild plugin for Eta template engine.
How to use?
import {templates, render} from "eta";
import button1 from "./partials/button.eta";
import link1 from "./partials/link.eta";
import defaultLayout from "./layout/index.eta";
import indexTemplate from "./views/index.eta";
templates.define("buttons/button1", button1);
templates.define("links/link1", link1);
templates.define("layout", defaultLayout);
const output = render(indexTemplate, {name: "linux_china"});
console.log(output);
esbuild example
const esbuild = require('esbuild');
const etaPlugin = require('esbuild-plugin-eta');
esbuild.build({
bundle: true,
entryPoints: ['hello.js'],
plugins: [etaPlugin],
write: false
}).then(result => {
console.log(result.outputFiles[0].text);
}).catch(() => process.exit(1));
References
- Eta: Lightweight, powerful, pluggable embedded JS template engine https://eta.js.org/
- esbuild: https://esbuild.github.io/