Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gulp minifyCss remove special comments

I am using gulp minifyCss to minify my css to reduce filesize. My gulp task looks something like this:

gulp.task('minify-css', function() {
  return gulp.src('styles/*.css')
    .pipe(concatCss("all.css").on('error', standardHandler))
    .pipe(minifyCss().on('error', standardHandler))
    .pipe(gulp.dest('dist'));
});

It works fine and output as expected. However, it does not remove special comments /*! comment */

How can I get minifyCss to have special comments removed?

like image 544
user1995781 Avatar asked Aug 12 '15 08:08

user1995781


1 Answers

You should set keepSpecialComments option:

gulp.task('minify-css', function() {
  return gulp.src('styles/*.css')
    .pipe(concatCss("all.css").on('error', standardHandler))
    .pipe(minifyCss({keepSpecialComments : 0}).on('error', standardHandler))
    .pipe(gulp.dest('dist'));
});
like image 55
Ufuk Hacıoğulları Avatar answered Oct 17 '22 08:10

Ufuk Hacıoğulları