Skip to content

Instantly share code, notes, and snippets.

@truongsinh
Created June 24, 2015 05:38
Show Gist options
  • Save truongsinh/cdfeb6f9298e5a2d6e43 to your computer and use it in GitHub Desktop.
Save truongsinh/cdfeb6f9298e5a2d6e43 to your computer and use it in GitHub Desktop.
gulp.task('ng-template-watch', function () {
gulp
.src('path/**/*.html')
.pipe(through2.obj(function(file, _, cb){
file.path += ".ts";
var prefix = 'var t =';
var suffix = ';\nexport default t;\n';
var newC = prefix + JSON.stringify(file.contents.toString()) + suffix;
file.contents = new Buffer(newC);
this.push(file);
cb();
}))
.pipe(gulp.dest('path/'))
;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment