-
Notifications
You must be signed in to change notification settings - Fork 3
Description
My Gulp FIle is as shown below
var handlebars=require('gulp-handlebars');
var handlebarSrc = config.appBasePath + '/js/templates/*/.hbss',
handlebarDest = config.appBasePath + '/js/libs/iea/core/js/',
handlebarDestFile = config.parentAppName + '.templates.js';
gulp.task('handlebars', function() {
return gulp.src(handlebarSrc)
.pipe(handlebars())
.pipe(wrap('Handlebars.template(<%= contents %>)'))
.pipe(declare({
namespace: 'templates',
noRedeclare: true, // Avoid duplicate declarations
processName: function(filePath) {
var a= filePath.split("\presentation").pop();
//var a = String(filePath.replace('C:\xampp\htdocs\IEA-Test\presentation', ''));
/////entension was js somehow changing it to hbss below
a = a.replace('.js', ".hbss");
return (a);
}
}))
.pipe(concat(handlebarDestFile))
.pipe(wrap('define(["handlebars","helpers"], function(Handlebars) {<%= contents %>return this["templates"];});'))
.pipe(gulp.dest(handlebarDest));
});
Directory structure ::
js- templates- carousel- defaultView.hbss
js-templates- form- defaultView.hbss
js-templates-searchInput-defaultView.hbss
......................................-defaultView.hbss
... and so on
output template.js file
WHAT I GET
define(["handlebars","helpers"], function(Handlebars) {
this["templates"] = this["templates"] || {};
this["templates"]["lib/js/templates/adaptive-image/defaultView"] = this["templates"]["lib/js/templates/adaptive-image/defaultView"] || {};
/////change needed here
this["templates"]["lib/js/templates/adaptive-image/defaultView"]["hbss"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
var stack1;
What I WANT::::
define(["handlebars","helpers"], function(Handlebars) {
this["templates"] = this["templates"] || {};
this["templates"]["lib/js/templates/adaptive-image/defaultView.hbss"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
var stack1;
Let me Know what is to be done in gulpfile handlebars to include extension in processName