JSPM

esbuild-plugin-eta

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 107
  • Score
    100M100P100Q81034F
  • License ISC

esbuild plugin for Eta JS template

Package Exports

  • esbuild-plugin-eta
  • esbuild-plugin-eta/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-eta) 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-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