Closed JohnnyIkarus closed 2 years ago
I was able to fix this problem by editing the gulpfile.js from:
...
gulp.task('templates', () => {
gulp
.src('./src/templates/**/*.hbs')
.pipe(
handlebars({
handlebars: require('handlebars')
})
)
.pipe(wrap('Handlebars.template(<%= contents %>)'))
.pipe(
declare({
root: 'exports',
noRedeclare: true, // Avoid duplicate declarations
namespace: 'templates',
processName: function (filePath) {
// Allow nesting based on path using gulp-declare's processNameByPath()
// You can remove this option completely if you aren't using nested folders
// Drop the templates/ folder from the namespace path by removing it from the filePath
return declare.processNameByPath(filePath.replace('src/templates/', '');
}
})
)
.pipe(concat('templates.js'))
.pipe(wrap('var Handlebars = require("handlebars/runtime");\n <%= contents %>'))
.pipe(gulp.dest('./src/js/compiled/'));
});
...
to
...
gulp.task('templates', () => {
gulp
.src('./src/templates/**/*.hbs')
.pipe(
handlebars({
handlebars: require('handlebars')
})
)
.pipe(wrap('Handlebars.template(<%= contents %>)'))
.pipe(
declare({
root: 'exports',
noRedeclare: true, // Avoid duplicate declarations
namespace: 'templates',
processName: function (filePath) {
// Allow nesting based on path using gulp-declare's processNameByPath()
// You can remove this option completely if you aren't using nested folders
// Drop the templates/ folder from the namespace path by removing it from the filePath
return declare.processNameByPath(filePath.replace('src/templates/', '').replace('src\\templates\\', ''));
}
})
)
.pipe(concat('templates.js'))
.pipe(wrap('var Handlebars = require("handlebars/runtime");\n <%= contents %>'))
.pipe(gulp.dest('./src/js/compiled/'));
});
...
I tried running the project on my windows machine. i followed the readme and installed the project using the yarn commands. when i access the test page i get the following error inside my browser: