I'm using Yo Generator's web app as base to build something with PUG. However it's still reference to Bower. So I switch all needed JS package to npm. But this gulp task is ignoring all libraries in node_modules
gulp.task('html', ['views', 'styles', 'scripts'], () => {
return gulp.src([
'tmp/**/*.html',
'app/**/*.html',
'!app/layouts/**/*'
])
.pipe($.useref({searchPath: [paths.tmp, paths.src, '.']}))
.pipe($.if(/\.js$/, $.uglify({ compress: {drop_console: true} })))
.pipe($.if(/\.css$/, $.cssnano({ safe: true, autoprefixer: true })))
.pipe($.if(/\.html$/, $.htmlmin({
collapseWhitespace: true,
minifyCSS: true,
minifyJS: {compress: {drop_console: true}},
processConditionalComments: true,
removeComments: true,
removeEmptyAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true
})))
.pipe(gulp.dest('dist'));
});
is there a way to tell gulp-useref to combine js lib from this path /node_modules/
Turns out it's gulp-uglify doesn't like es6 such as "let" in some JS lib. So the solution is to use gulp-uglify-es instead.