Skip to content

Gulp-useref - excessive re-minifications #728

@olzhaskaliyev

Description

@olzhaskaliyev

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}));
});

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions