gulp-template-cache

0.0.2 • Public • Published

Gulp Template Cache

This is a Gulp plugin that converts HTML files into JavaScript strings that can then be quickly accessed through a global variable.

Installation and Usage

In a shell:

npm install --save-dev gulp-template-cache

In your gulpfile.js:

var templateCache = require('gulp-template-cache');

gulp.task('compile:templates', function() {
  return gulp.src('src/**/*.tpl.html')
    .pipe(templateCache())
    .pipe(gulp.dest('build'));
});

Options

  • fileName: The name of the JavaScript file that should be output by the plugin. Defaults to 'templates.js'.
  • globalVariable: The name of the global variable that should reference the template cache. Defaults to 'templateCache'.
  • nameFunction: A function that takes a template filepath and returns the string name of that template in the cache. Defaults to using the raw filepath.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.2
    3
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.2
    3
  • 0.0.1
    0

Package Sidebar

Install

npm i gulp-template-cache

Weekly Downloads

3

Version

0.0.2

License

MIT

Last publish

Collaborators

  • kylepixel