gulp-ngtemplateurl

0.0.6 • Public • Published

gulp-ngTemplateUrl Build Status npm version

Gulp plugin to replace all your templateUrl development code with template. It will get the html file from the templateUrl path, transform into a single string and inject it into template option.

Install

  npm install gulp-ngtemplateurl --save-dev

or

  npm i gulp-ngtemplateurl --save-dev

Usage

You should use gulp-ngtemplateurl within a gulp task:

'use strict';
 
var gulp        = require('gulp')
var templateUrl = require('gulp-ngtemplateurl')
 
 
gulp.task('default', function(){
  return gulp.src('./code/*.js')
          .pipe(tUrl())
          .pipe(gulp.dest('./dist/'))
})
 

You can also use it with streams, something like this:

var gulp        = require('gulp'),
    templateUrl = require('gulp-ngtemplateurl'),
    browserify  = require('browserify'),
    source      = require('vinyl-source-stream'),
    entries     = ['./public/app.js'],
    options     = assign({}, browserify.args, { entries }),
    bwInstance  = browserify(options)
 
bwInstance.on('update', bundle);
 
gulp.task('bundle', bundle);
 
function bundle(){
  return bwInstance.bundle()
            .pipe(source('bundle.js'))
            .pipe(templateUrl())
            .pipe(buffer())
            .pipe(gulp.dest('./public/dist'));
}

TODO

  • Exception Handler
  • At least 80% code-coverage
  • Optimize finding and replacing templateUrl with template

Package Sidebar

Install

npm i gulp-ngtemplateurl

Weekly Downloads

1

Version

0.0.6

License

MIT

Last publish

Collaborators

  • opsigor