Now since we have our css in a single file, we can continue to increase the performance of our site by minifying our css.
Minifying is the process of eliminating all the unnecessary formatting in a css file. Human’s need spaces and tabs (also known as white space) to more easily read the styles. A browser doesn’t care about white space so we can make the file smaller by removing them.
You should start seeing a pattern when using gulp… because for this we need to use a plugin:
vargulp=require('gulp');varconcat=require('gulp-concat');varclean=require('gulp-rimraf');varcssmin=require("gulp-minify-css");gulp.task('clean',[],function(){console.log("Clean all files in build folder");returngulp.src("build/*",{read:false}).pipe(clean());});gulp.task('default',['clean'],function(){console.log("Concat, move, and minify all the css files in styles folder");returngulp.src("contents/styles/**.css").pipe(concat('main.min.css')).pipe(cssmin()).pipe(gulp.dest('build/styles'));});