gulp-jqtmpl

0.0.6 • Public • Published

gulp-jqtmpl

Compile jQuery templates with Gulp

Installation

npm install -save gulp-jqtmpl

Usage

    var gulp = require('gulp');
    var compile = require('gulp-jqtmpl');
 
    gulp.task('CompileTemplates', function () {
        gulp.src('./templates.html')
            .pipe(compile({/* options */}))
            .pipe(gulp.dest('./templates.js'));
 
    });

Compile separate templates file into one file

Use gulp-concat to combine all of your template files before compiling.

    var gulp = require('gulp');
    var compile = require('gulp-jqtmpl');
    var concat = require('gulp-concat');
 
    gulp.task('CompileTemplates', function () {
        gulp.src('./templates/*.html')
            .pipe(concat('combinedTemplates.html'))
            .pipe(compile({/* options */}))
            .pipe(gulp.dest('./templates.js'));
 
    });

Options

  • map [function(object): string] - This function takes an object containing the name of the template and the template function and returns the string written to the file. By default this function uses the exports object
        exports['<template_name>'] = <template_function>;
  • prefix [string] - A string to start the file with. Default is null.

  • suffix [string] - A string to end the file with. Default is null.

License

gulp-jqtmpl is Copyright (c) 2015 Ryan Turnquist and licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved.

Package Sidebar

Install

npm i gulp-jqtmpl

Weekly Downloads

1

Version

0.0.6

License

MIT

Last publish

Collaborators

  • ryanturnquist