We are utilizing Gulp for our build process and one of the primary tasks is to merge all .html
template partials from various module folders into a single .js
templateCache file. This ensures that users only need to download one file containing all the HTML
templates.
Current Setup and Requirements in Gulp:
var gulp = require('gulp'),
gutil = require('gulp-util'),
gulpif = require('gulp-if'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
sass = require('gulp-ruby-sass'),
streamqueue = require('streamqueue'),
sourcemaps = require('gulp-sourcemaps'),
templateCache = require('gulp-angular-templatecache'),
runSequence = require('run-sequence'),
del = require('del'),
es = require('event-stream');
var config = {
srcPartials:[
'app/beta/*',
'app/header/**/*',
'app/help/*',
'app/login/*',
'app/notificaitons/*',
'app/panels/**/*',
'app/popovers/**/*',
'app/popovers/*',
'app/user/*',
'app/dashboard.html'
],
destPartials: [
'app/templates/'
]
};
The Gulp task for html-templates
:
/** HTML Template caching */
/** ------------------------------------------------------------------------- */
gulp.task('html-templates', function() {
return gulp.src(config.srcPartials)
.pipe(templateCache())
.pipe(gulp.dest(config.destPartials));
});
As seen above, the goal is to collect all the .html files located within the folders listed under srcPartials
, apply templateCache
on them, and output the result to the destination specified in destPartials
.
However, an error message is currently being encountered:
Error: Invalid output folder at Gulp.dest
Initially, it was assumed that the task did not automatically create the folder, so the directory app/templates
was manually created. Nevertheless, the error persists. Any insights or suggestions?