Integrating Sass with Gulp
Before we use Sass, we need to install it in our project and then add some additional code to gulpfile.js
. Thankfully, all the steps are fairly simple. The steps are as follows:
- Install a version of Sass that Gulp can use by executing the following command:
$ npm install --save-dev gulp-sass@2.0.4
- Next, modify
gulp/config.js
to define where our SCSS files live, and where the output should be placed:assets: { copy: […], code: {…}, styles: {src: "www/scss/app.scss", dest: "www/css"} }
- Now, create
gulp/tasks/copy-scss.js
:var gulp = require("gulp"), sass = require("gulp-sass"), notify = require("gulp-notify"), sourcemaps = require("gulp-sourcemaps"), gutil = require("gulp-util"), config = require("../config"), settings = require("../settings"), paths = require("../utils/paths"); function copySCSS()...