Gulp plugin for converting AngularJS templates to JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Update gulpfile.js Feb 16, 2016
lib Fix 'app is not defined' bug. Mar 2, 2016
.gitignore + Changed structure to support adapters Feb 15, 2016
LICENSE update readme and bump to v0.3.0 Dec 4, 2015
README.md no travis Feb 16, 2016
index.js Update index.js Feb 16, 2016
package.json bump to 0.4.2 Mar 2, 2016

README.md

gulp-html2js

NPM version Downloads

Gulp plugin for converting AngularJS templates to JavaScript

See more from grunt-html2js

Install

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

Usage

Angular

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/'));
});

Vanilla

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/'));
});

Available options

  • 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

LICENSE

(MIT License)

Copyright (c) 2015 Fraserxu xvfeng123@gmail.com