Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    gulp-process-templatespublic

    gulp-process-templates

    Gulp task to process templates and include the escaped content into js files.

    Install

    npm install gulp-process-templates

    Use

    Given a js file...

    var assert = require("assert");
     
    describe("Task should replace @include with the template", function() {
      var template = /* @include template.html.tpl */;
      it("replace the @include with the escaped content of the file", function() {
        assert.equal('<div class="row"></div>', template);
      });
    });

    ... and a template ...

    <div class="row"></div>

    ... then declaring a task on your gulpfile.js ...

    'use strict'
     
    var gulp = require('gulp');
    var processTemplates = require('./index.js');
     
    gulp.task('compile', function() {
      gulp.src('./test/*.js')
       .pipe(processTemplates())
       .pipe(gulp.dest('./compiledtest'));
    });

    ... will result

    var assert = require("assert");
     
    describe("Task should replace @include with the template", function() {
      var template = "<div class=\"row\"></div>";
      it("replace the @include with the escaped content of the file", function() {
        assert.equal('<div class="row"></div>', template);
      });
    });

    install

    npm i gulp-process-templates

    Downloadslast 7 days

    2

    version

    1.1.0

    license

    MIT

    repository

    github.com

    last publish

    collaborators

    • avatar
    • avatar