October 2017
Intermediate to advanced
458 pages
11h 13m
English
Next, we are going to give our CSS the same kind of treatment. I think you pretty much get the point by now, so I will be short about this. First, install the gulp-clean-css package (https://github.com/scniro/gulp-clean-css):
npm install gulp-clean-css --save-dev
The Gulp clean CSS plugin makes use of clean CSS, so for any options, check their documentation, https://github.com/jakubpawlowicz/clean-css. There are a lot of options. I will not go over them, but I am sure you can figure them out if you need them.
And then simply create a task that does the work:
gulp.task('minify-css', function() { return gulp.src('css/*.css') .pipe(cleancss({ compatibility: 'ie9' })) .pipe(gulp.dest('prod/css'));});
Run the gulp minify-css command ...
Read now
Unlock full access