# babel-plugin-lodash-template-precompile

> Babel plugin to precompile Lodash templates

Latest version **1.0.0** (published 2016-11-17) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-lodash-template-precompile
pnpm add babel-plugin-lodash-template-precompile
yarn add babel-plugin-lodash-template-precompile
bun add babel-plugin-lodash-template-precompile
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2016-11-17 |
| First published | 2016-11-17 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Justin Cataldo |
| Maintainers | jdcataldo |
| Keywords | babel-plugin, lodash, template, jst |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-lodash-template-precompile
- Repository: https://github.com/animoto/babel-plugin-lodash-template-precompile
- Homepage: https://github.com/animoto/babel-plugin-lodash-template-precompile#readme
- Issues: https://github.com/animoto/babel-plugin-lodash-template-precompile/issues
- npm.io page: https://npm.io/package/babel-plugin-lodash-template-precompile

## Dependencies (1)

- [lodash.template](https://npm.io/package/lodash.template.md) 4.4.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2016-11-17

## README

# babel-plugin-lodash-template-precompile
Babel plugin to precompile Lodash templates

## Install

```shell
$ npm i --save-dev babel-plugin-lodash-template-precompile
```

## Example

Transforms
```js
import template from 'lodash/template';

export default template`<div>hello {{ user }}!</div>`
```

to
```js
export default function (data) {
  var __t,
      __p = '';

  __p += '<div>hello ' + ((__t = user) == null ? '' : __t) + '!</div>';
  return __p;
};
```

## Usage

###### via .babelrc (Recommended)
```json
{
  "plugins": [["lodash-template-precompile", {"interpolate" : "\\{\\{(.+?)\\}\\}", "evaluate" : "\\[\\[(.+?)\\]\\]", "variable": "data"}]],
  "presets": ["es2015"]
}
```

###### via Babel CLI
```sh
$ babel --plugins lodash-template-precompile --presets es2015 script.js
```

###### via Babel API
```js
require('babel-core').transform('code', {
  'plugins': [["lodash-template-precompile", {"interpolate" : "\\{\\{(.+?)\\}\\}", "evaluate" : "\\[\\[(.+?)\\]\\]", "variable": "data"}]],
  'presets': ['es2015']
});
```

Note that setting ``` variable ``` is required for use within ``` strict mode ```

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