node package manager

Introducing npm Enterprise add-ons. Integrate third-party dev tools into npm…

gulp-html2js

Gulp plugin for converting AngularJS templates to JavaScript

gulp-html2js

Gulp plugin for converting AngularJS templates to JavaScript

See more from grunt-html2js

Install with npm npm install --save-dev gulp-html2js

var gulp = require('gulp');
var html2js = require('gulp-html2js');
 
gulp.task('default', function () {
    gulp.src('templates/*.html')
        .pipe(html2js('angular.js', {
            adapter: 'angular',
            base: 'templates',
            name: 'angular-demo'
        }))
        .pipe(gulp.dest('dist/'));
});
var gulp = require('gulp');
var html2js = require('gulp-html2js');
 
gulp.task('default', function () {
    gulp.src('templates/*.html')
        .pipe(html2js('js-demo.js', {
            adapter: 'javascript',
            base: 'templates',
            name: 'js-demo'
        }))
        .pipe(gulp.dest('dist/'));
});
  • base - project source path default to "."
  • quoteChar - default to "
  • indentString - default to " " (two spaces)
  • target (coffee support to be added)
  • useStrict - default to false
  • name - module name

(MIT License)

Copyright (c) 2015 Fraserxu xvfeng123@gmail.com