Minify CSS using Gulp

For minifying, you can use csso plugin. 
Install 
npm install gulp-csso –save-dev
Create a new task for minifying the css using this plugin

var gulp = require('gulp');
//gulp-load-plugins helps for a cleaner syntax
var $ = require('gulp-load-plugins')({ lazy: true });

gulp.task(“theme-css”,
function () {
return gulp.src([“./Theme/default.css”])
.pipe($.csso())
.pipe($.concat(‘default.min.css’))
.pipe(gulp.dest(‘./build/theme/’));
});

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s