I'm trying to run a task to minify and other stuff in my index.html:
gulp.task('bundle', function(){
var assets = useref.assets();
var autoprefixerConfig = {
browsers: ['last 2 versions', '> 4%', '> 4% in BR'],
cascade: false
};
return gulp.src('src/*.html')
.pipe(assets)
.pipe(gulpif('*.js', uglify()))
.pipe(gulpif('*.css', autoprefixer(autoprefixerConfig), minifyCss()))
.pipe(assets.restore())
.pipe(useref())
.pipe(minifyHtml())
.pipe(gulp.dest('dist'));
});
But all javascripts (like bootstrap.js, respond.js...) appear to be wrong in output files.
What I'm doing wrong?
I created an individual task for minifyHtml and this solved the problem.
Thanks to @mitogh and @entre