I am trying to create this workflow to have all the dependency Java Script files to be combined and minified for production.
Project Structure:

Error in my html
bundle.js:1369 Uncaught Error: Popover requires tooltip.js at bundle.js:1369 at Object.8 (bundle.js:1457) at s (bundle.js:1) at e (bundle.js:1) at bundle.js:1
Ideally this means the order in which Java script concatenation is not in order. I read somewhere that Browserify takes of it.
Any idea how to get over this error?
Here is my Gulp Task:
gulp.task('scripts', function() {
var bundler = function() {
var b = browserify(),
stream = through.obj(function(file, enc, next) {
// add each file to the bundle
b.add(file.path);
next();
}, function(next) {
b.bundle(function(err, src) {
// create a new vinyl file with bundle contents
// and push it to the stream
stream.push(new vinyl({
path: 'bundle.js', // this path is relative to dest path
contents: src
}));
next();
});
});
return stream;
};
return gulp.src('code/source/**/*.js')
// multiple entry files going to bundler
// you can apply jslint, jsbeautify on src files here
.pipe(bundler())
// single bundle file
// apply minification or/and rename bundle file here
.pipe(gulp.dest('code/public/js'));
});
No responses yet.