nordicmaterial2
8/4/2016 - 10:08 AM

GULP init of a project: compile SASS

GULP init of a project: compile SASS

// cd to project folder root and install the package.json file

$ npm init

// Follow all the steps:give name, description etc in command line. 
// Then install a local version of Gulp en Gulp Sass

$ npm install --save-dev gulp gulp-sass

// create a gulpfile.js in the project root

$ touch gulpfile.js

// fill the gulp.js file with task code:

var gulp = require( 'gulp' );
var sass = require( 'gulp-sass' );

gulp.task( 'sass', function() {
	gulp.src( './styles/sass/*.scss' )
		.pipe( sass().on( 'error', sass.logError ) )
		.pipe( gulp.dest( './styles/css/' ) );
});

gulp.task( 'default', function() {
	gulp.watch( './styles/sass/*.scss', ['sass'] );
});