-1

My gulp save the css width 0kb.

This is my code

https://jsfiddle.net/v6y0qkux/

gulp.task('jpg', function () {
    gulp.src('./template/img/**/*.*')
            .pipe(changed('./dist/img/'))
            .pipe(imagemin({
                progressive: true
            }))
            .pipe(gulp.dest('./dist/img/'));
});

Sometimes it save as normal, but the most times, it save 0km.

Golden Gate
  • 1,132
  • 4
  • 14
  • 25
concas
  • 99
  • 3

1 Answers1

0

There is a solution that comes from a project of mine.

You need to install the npm package : gulp-minify-css

npm install gulp-minify-css

Here is the code to handle minimification.

var minimifyCss = require('gulp-minify-css');

gulp.task('minify-css', function() {

return gulp.src([__dirname + '/your directory/*/**.css'])
    .pipe(minifyCss({comments:true, spare:true}))
    .pipe(gulp.dest(__dirname + '/your directory destination'))
});
Disfigure
  • 667
  • 5
  • 19