Operation Flow in Gulp
Let's now learn how to perform multiple operations on files. For example, first convert LESS to CSS, and then minify the resulting CSS.
To start, let's import everything we need:
let {src, dest} = require('gulp');
let less = require('gulp-less');
let cleanCSS = require('gulp-clean-css');
Now let's perform the described operations:
function task(cb) {
return src('src/*.less')
.pipe(less())
.pipe(cleanCSS())
.pipe(dest('dist'));
}
Convert Stylus files to CSS using the gulp-stylus plugin, then add prefixes to properties using the gulp-autoprefixer plugin and then perform minification of the resulting CSS using the gulp-csso plugin.