Gulp plugin to join AngularJS templates in one JavaScript template cache
npm install gulp-templatecachegulp-templatecache
============
Gulp plugin to join AngularJS templates in one JavaScript template cache
Install with npm
npm install --save-dev gulp-templatecache
``javascript
var templateCache = require('gulp-templatecache')
gulp.task('scripts', function() {
var options = {
output: 'public/templates.js',
stripFromPath: 'public/templates',
prependToPath: 'partials',
// angular module name
moduleName: 'templates',
minify: {}
}
gulp.src('public/templates/*/.html')
.pipe(templateCache(options))
.pipe(gulp.dest('./'))
// the result is a file with all templates inside
// registered on module "templates" with the
// path being transformed into "partials/*/.html"
// and saved to "public/templates.js"
})
`
This plugin converts a group of templates to JavaScript (html escaped as JS) and put them inside a module.run() block to inject them right into $templateCache
#### output
Type: String
The output filename
#### moduleName
Type: String
The AngularJS module name to use. If the module does not exists yet, it will create one.
#### stripFromPath
Type: String
Default:
Path fragment to remove from template path (from beginning of all template paths)
#### prependToPath
Type: String
Default:
Path fragment to insert at beginning of all template path
#### minify
Type: Object|Booleanfalse
Default:
Configs to pass on html-minifier.
If ommitted or false`, the HTML is kept untouched
[npm-url]: https://npmjs.org/package/gulp-templateCache