0.1.1 • Published 10 years ago

gulp-tpl2mod v0.1.1

Weekly downloads
1
License
BSD-2-Clause
Repository
github
Last release
10 years ago

gulp-tpl2mod

gulp plugin to transform plain text to javascript string

Usage

var gulp = require('gulp');
var tpl = require('gulp-tpl2mod');

Build to CommonJS module

  gulp.src(path.join(__dirname, 'templates/*.html'))
      .pipe(tpl({
        prefix: 'module.exports=require("tpl").compile(',
        suffix: ')'
      }))
      .pipe(gulp.dest(path.join(__dirname, 'built_templates/')));

Build to AMD module

  gulp.src(path.join(__dirname, 'templates/*.html'))
      .pipe(tpl({
        prefix: 'define(["tpl"],function(tpl){return tpl.compile(',
        suffix: ')})'
      }))
      .pipe(gulp.dest(path.join(__dirname, 'built_templates/')));

You may adjust tpl in prefix string as need.

Options

Same as tpl2mod.