0.0.2 • Published 9 years ago

gulp-htmlbars-compiler v0.0.2

Weekly downloads
44
License
MIT
Repository
github
Last release
9 years ago

Gulp HTMLBars compiler

Install gulp htmlbars compiler.

npm install --save gulp-htmlbars-compiler

Use in Gulp. You must pass ember-template-compiler.js file that is paired with your Ember version.

var compiler = require('path/to/bower_components/ember/ember-template-compiler');
var htmlbars = require('gulp-htmlbars-compiler');

gulp.task('templates', function() {
	return gulp.src('path/to/*.hbs')
		.pipe(htmlbars(
			compiler: compiler, // Required
			pathHandler: function(filePath, separator) {} // Optional
		))
		.pipe(uglify())
        .pipe(concat('templates.js'))
        .pipe(gulp.dest('path/to/assets'));
});

pathHandler is a function to handle path for Ember.TEMPLATES object. It gets two arguments:

Output file.

Ember.TEMPLATES.posts=Ember.HTMLBars.template(function(){});
Ember.TEMPLATES.post=Ember.HTMLBars.template(function(){});
Ember.TEMPLATES["post/edit"]=Ember.HTMLBars.template(function(){});