What is wrong with this html code:
<!-- build:js js/main.min.js -->
<script src="js/main.js" charset="utf-8"></script>
<script src="js/pages/orders.js" charset="utf-8"></script>
<!-- endbuild -->
And this gulp task:
gulp.task('javascript', function() {
return gulp.src('app/js/main.js')
.pipe(through2.obj(function(file, enc, next) {
browserify({
entries: file.path,
debug: isDevelopment
}).bundle(function(err, res) {
if (err) {
return next(err);
}
file.contents = res;
next(null, file);
});
}))
.on('error', function(error) {
console.log(error.stack);
this.emit('end');
})
.pipe(gulp.dest('dist/js'))
.pipe($.if(isDevelopment, $.sourcemaps.init({
loadMaps: true
})))
.pipe($.if(isDevelopment, $.sourcemaps.write('.')))
.pipe(gulp.dest('.tmp/js'));
});
Because I'm always getting only main.js inside main.min.js file, instead of main.js and orders.js merged and minified together into main.min.js
Thank you!
error is in your code itself. You need to change the second line to
return gulp.src('app/js/**/*.js')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.