gulp-fixed-template

1.1.0 • Public • Published

gulp-fixed-template

Render a single template using the gulp stream files. Uses lodash rendering engine.

Installation

npm install --save-dev gulp-fixed-template

Example

var fixedTemplate = require('gulp-fixed-template');
var gulp = require('gulp');
 
// this example replaces every file's contents with its file name.
gulp.task('buildTemplates', function() {
  return gulp.src('./**/*')
    .pipe(fixedTemplate('<%= fileName %>', function(file) {
      var fileParts = file.path.split('/');
      return {
        fileName: fileParts[fileParts.length-1];
      };
    }))
    .pipe(gulp.dest('./'));
});

Options

  • templateText - required - Template text with placeholders for objects you want replaced.
  • templateFunction - required - Function that takes in a vinyl file and returns the object to be fed into the templating function.

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i gulp-fixed-template

Weekly Downloads

56

Version

1.1.0

License

MIT

Unpacked Size

1.85 kB

Total Files

3

Last publish

Collaborators

  • sedenardi