# gulp-template-compile-new

> Gulp task to precompile lodash templates

Latest version **5.0.3** (published 2016-05-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-template-compile-new
pnpm add gulp-template-compile-new
yarn add gulp-template-compile-new
bun add gulp-template-compile-new
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.0.3 |
| Published | 2016-05-18 |
| First published | 2016-05-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 23 |
| Author | Ingruz |
| Maintainers | duxet |
| Keywords | gulpplugin, lodash, template, precompile, compile, html, javascript |

## Links

- npm: https://www.npmjs.com/package/gulp-template-compile-new
- Repository: https://github.com/ingro/gulp-template-compile
- Homepage: https://github.com/ingro/gulp-template-compile#readme
- Issues: https://github.com/ingro/gulp-template-compile/issues
- npm.io page: https://npm.io/package/gulp-template-compile-new

## Dependencies (3)

- [through2](https://npm.io/package/through2.md) ~0.5.1
- [gulp-util](https://npm.io/package/gulp-util.md) ~3.0.0
- [lodash.template](https://npm.io/package/lodash.template.md) ~4.2.5

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 5.0.3 (latest) — 2016-05-18
- 5.0.2 — 2016-05-18
- 5.0.1 — 2016-05-18
- 5.0.0 — 2016-05-18
- 4.12.0 — 2016-05-18

## README

# [gulp](https://github.com/wearefractal/gulp)-template-compile

> Compile [Lo-Dash templates](http://lodash.com/docs#template) (should work with [Underscore templates](http://underscorejs.org/#template) too).

## Synopsis

This plugin is heavily inspired by [Sindre Sorhus](https://github.com/sindresorhus)'s [gulp-nunjucks](https://github.com/sindresorhus/gulp-nunjucks) plugin, in fact I used it as skeleton for creating this one.

## Install

Install with [npm](https://www.npmjs.org/package/gulp-template-compile)

```
npm install --save-dev gulp-template-compile
```

## Example

### `gulpfile.js`

```js
var gulp = require('gulp');
var template = require('gulp-template-compile');
var concat = require('gulp-concat');

gulp.task('default', function () {
	gulp.src('src/*.html')
		.pipe(template())
		.pipe(concat('templates.js'))
		.pipe(gulp.dest('dist'));
});
```

## API

See the [Lo-Dash `_.template` docs](http://lodash.com/docs#template).


### template(options)

### options

Type: `Object`

#### options.name

Type: `Function`
Default: *Relative template path. Example: `templates/list.html`*

You can override the default behavior by supplying a function which gets the current [File](https://github.com/wearefractal/vinyl#constructoroptions) object and is expected to return the name.

Example:

```js
{
	name: function (file) {
		return 'tpl-' + file.relative;
	}
}
```

#### options.namespace
Type: `String`
Default: 'JST'

The namespace in which the precompiled templates will be assigned. Starting from version **1.0** you could also provide a dotted namespace that will be correctly handled, thanks to **fhawkes**. For example 'custom.namespace' will result in `window['custom']['namespace']`.

#### options.templateSettings
Type: `Object`
Default: null

[Lo-Dash `_.template` options](http://lodash.com/docs#template).

## Changelog

#### 1.0:
* **BREAKING**: Added support for custom dotted namespaces.

## Notes

If you use [grunt](http://gruntjs.com) instead of gulp, but want to perform a similar task, use [grunt-contrib-jst](https://github.com/gruntjs/grunt-contrib-jst).


## License

MIT © Emanuele Ingrosso

---
_Source: https://npm.io/package/gulp-template-compile-new · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
