gulp Minifying CSS Sass and Css - Preprocessing with Gulp


Before starting gulp we need to install node.js and npm. Then install gulp-sacc

$ npm i gulp-sass --save-dev // i = install

Gulp Head

var gulp = require('gulp');
// Requires the gulp-sass plugin
var sass = require('gulp-sass');

Gulp Body

gulp.task('sass', function(){
  return gulp.src('app/scss/*.scss') // searching for sass files
    .pipe(sass()) // Converts Sass to CSS with gulp-sass
    .pipe(gulp.dest('app/css')) // destination of the css file

Gulp watch

gulp.task('watch', function(){'app/scss/**/*.scss', ['sass']); 
  // Other watchers