Eta loader plugin for rollup.js
npm install rollup-plugin-etarollup-plugin-eta 
=================
Rollup.js template loader plugin for η (Eta). Supports loading of any files with proper Eta content.
Using NPM:
``sh`
npm install eta rollup-plugin-eta --save-dev
or Yarn:
`sh`
yarn add --dev eta rollup-plugin-eta
Create a rollup.config.js configuration file and import the plugin:
`js
// rollup.config.js
import eta from 'rollup-plugin-eta';
rollup({
entry: 'main.js',
output: [
{
dir: 'dist',
format: 'esm'
},
],
plugins: [
eta({
include: ['/.eta', '/.html'], // optional, '*/.eta' by default
exclude: ['**/index.html'], // optional, undefined by default
data: {
name: 'John Doe'
}, // optional, default template data
etaConfig: {
tags: ['<%', '%>']
} // optional, eta configuration
}),
],
});
`
In your app you can then import your template and render its content, e.g.:
`javascript`
// main.js
import tpl from './tpl.eta';
console.log(tpl({ age: 42 }));
If your template file (tpl.eta) looks as follows:
` Hello 👋 , my name is <%= it.name %> and I am <%= it.age %> year old ✨html`
Then, your compiled file would return:
` Hello 👋 , my name is John Doe and I am 42 year old ✨sh`
$ node ./dist/main.js
The following options are unique to rollup-plugin-eta:
Type: String | Array[...String]['*/.eta']
Default:
A minimatch pattern, or array of patterns, which specifies the files in the build the plugin should operate on. By default all */.eta files are targeted.
Type: String | Array[...String][]
Default:
A minimatch pattern, or array of patterns, which specifies the files in the build the plugin should _ignore_. By default no files are ignored.
Type: Objectnull
Default:
A default set of data inputs for the template.
Type: Objectnull
Default:
The default Eta configuration object (Eta.config`).
You have an idea on how to improve the package, please send us a pull request! Have a look into our contributing guidelines.
Running into issues or are you missing a specific usecase? Feel free to file an issue.
---
Copyright 2021 © Stateful – Apache 2.0 License