https://github.com/linux-china/esbuild-plugin-eta
esbuild plugin for Eta template
https://github.com/linux-china/esbuild-plugin-eta
esbuild eta
Last synced: 5 months ago
JSON representation
esbuild plugin for Eta template
- Host: GitHub
- URL: https://github.com/linux-china/esbuild-plugin-eta
- Owner: linux-china
- License: isc
- Created: 2021-11-19T07:04:01.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-11-28T16:30:58.000Z (almost 4 years ago)
- Last Synced: 2025-05-14T07:17:02.493Z (5 months ago)
- Topics: esbuild, eta
- Language: JavaScript
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
esbuild-plugin-eta
==================================
An esbuild plugin for [Eta template engine](https://eta.js.org/).# How to use?
```javascript
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
```javascript
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/](https://eta.js.org/)
* esbuild: [https://esbuild.github.io/](https://esbuild.github.io/)