# rollup-plugin-eta

> Eta loader plugin for rollup.js

Latest version **1.0.1** (published 2022-09-28) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install rollup-plugin-eta
pnpm add rollup-plugin-eta
yarn add rollup-plugin-eta
bun add rollup-plugin-eta
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2022-09-28 |
| First published | 2021-11-29 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | ESM |
| Node | ^14.13 \|\| >=16 \|\| >=18 |
| Dependencies | 2 |
| Unpacked size | 117.9 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Christian Bromann |
| Maintainers | stateful-wombot |
| Keywords | rollup, rollup-plugin, eta, template |

## Links

- npm: https://www.npmjs.com/package/rollup-plugin-eta
- Repository: https://github.com/stateful/rollup-plugin-eta
- Issues: https://github.com/stateful/rollup-plugin-eta/issues
- npm.io page: https://npm.io/package/rollup-plugin-eta

## Dependencies (2)

- [eta](https://npm.io/package/eta.md) ^1.12.3
- [rollup-pluginutils](https://npm.io/package/rollup-pluginutils.md) ^2.8.2

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2022-09-28
- 1.0.0 — 2022-07-13
- 0.1.4 — 2021-11-29
- 0.1.3 — 2021-11-29
- 0.1.2 — 2021-11-29
- 0.1.1 — 2021-11-29
- 0.1.0 — 2021-11-29

## README

rollup-plugin-eta [![Test Changes](https://github.com/stateful/rollup-plugin-eta/actions/workflows/test.yaml/badge.svg)](https://github.com/stateful/rollup-plugin-eta/actions/workflows/test.yaml)
=================

[Rollup.js](https://rollupjs.org/guide/en/) template loader plugin for [η (Eta)](https://eta.js.org/). Supports loading of any files with proper Eta content.

## Installation

Using NPM:

```sh
npm install eta rollup-plugin-eta --save-dev
```

or Yarn:

```sh
yarn add --dev eta rollup-plugin-eta
```

## Usage

Create a `rollup.config.js` [configuration file](https://www.rollupjs.org/guide/en/#configuration-files) 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:

```html
<p>Hello 👋 , my name is <%= it.name %> and I am <%= it.age %> year old ✨</p>
```

Then, your compiled file would return:

```sh
$ node ./dist/main.js
<p>Hello 👋 , my name is John Doe and I am 42 year old ✨</p>
```

## Options

The following options are unique to `rollup-plugin-eta`:

### `include`

Type: `String` | `Array[...String]`<br>
Default: `['**/*.eta']`

A [minimatch pattern](https://github.com/isaacs/minimatch), or array of patterns, which specifies the files in the build the plugin should operate on. By default all `**/*.eta` files are targeted.

### `exclude`

Type: `String` | `Array[...String]`<br>
Default: `[]`

A [minimatch pattern](https://github.com/isaacs/minimatch), or array of patterns, which specifies the files in the build the plugin should _ignore_. By default no files are ignored.

### `data`

Type: `Object`<br>
Default: `null`

A default set of data inputs for the template.

### `etaConfig`

Type: `Object`<br>
Default: `null`

The default Eta configuration object (`Eta.config`).

## Contribute

You have an idea on how to improve the package, please send us a pull request! Have a look into our [contributing guidelines](CONTRIBUTING.md).

## Getting Help

Running into issues or are you missing a specific usecase? Feel free to [file an issue](https://github.com/stateful/rollup-plugin-eta/issues/new).

---

<p align="center"><small>Copyright 2021 © <a href="http://stateful.com/">Stateful</a> – Apache 2.0 License</small></p>

---
_Source: https://npm.io/package/rollup-plugin-eta · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
