yeoman / generator-webapp

A gulp.js generator for modern webapps
3.77k stars 708 forks source link

Gulp-useref - excessive re-minifications #728

Open olzhaskaliyev opened 5 years ago

olzhaskaliyev commented 5 years ago

Hello! I have gulp configuration with Pug compilation. When running task with gulp-useref is minificate sames css/js files repeatly on every html page. I tried use gulp-cache, but seems i use this wrong. There is my gulpfile.js:

gulp.task('minimization', ['templates', 'styles', 'scripts'], () => {
  return gulp.src('.tmp/*.html')
    .pipe($.useref({searchPath: ['.tmp', '.']}))
    .pipe($.if(/\.css$/, $.cache($.cssnano({safe: true, autoprefixer: false}))))
    .pipe($.if(/\.js$/, $.cache($.uglify({compress: {drop_console: true}}))))
    .pipe(gulp.dest('dist'))
    .pipe($.size({title: 'minimized', showFiles: true}));
});
UlisesGascon commented 4 years ago

We made a major changes in the Generator and we need to update the recepies. This process is currently ongoing #742. Did you find a solution? Do you want to help us improve the recipe