Added SASS support to Gulpfile.js

Fixes #6860
This commit is contained in:
Arjan Noordende 2016-05-05 20:58:18 +01:00 committed by Sébastien Ros
parent dfa22687b5
commit 91488f31da
2 changed files with 4 additions and 1 deletions

View File

@ -8,6 +8,7 @@ var fs = require("fs"),
plumber = require("gulp-plumber"),
sourcemaps = require("gulp-sourcemaps"),
less = require("gulp-less"),
sass = require("gulp-sass"),
autoprefixer = require("gulp-autoprefixer"),
minify = require("gulp-minify-css"),
typescript = require("gulp-typescript"),
@ -123,7 +124,7 @@ function createAssetGroupTask(assetGroup, doRebuild) {
function buildCssPipeline(assetGroup, doConcat, doRebuild) {
assetGroup.inputPaths.forEach(function (inputPath) {
var ext = path.extname(inputPath).toLowerCase();
if (ext !== ".less" && ext !== ".css")
if (ext !== ".less" && ext !== ".scss" && ext !== ".css")
throw "Input file '" + inputPath + "' is not of a valid type for output file '" + assetGroup.outputPath + "'.";
});
var generateSourceMaps = assetGroup.hasOwnProperty("generateSourceMaps") ? assetGroup.generateSourceMaps : true;
@ -138,6 +139,7 @@ function buildCssPipeline(assetGroup, doConcat, doRebuild) {
.pipe(plumber())
.pipe(gulpif(generateSourceMaps, sourcemaps.init()))
.pipe(gulpif("*.less", less()))
.pipe(gulpif("*.scss", sass()))
.pipe(gulpif(doConcat, concat(assetGroup.outputFileName)))
.pipe(autoprefixer({ browsers: ["last 2 versions"] }))
// TODO: Start using below whenever gulp-header supports sourcemaps.

View File

@ -11,6 +11,7 @@
"gulp-plumber": "1.0.1",
"gulp-sourcemaps": "1.6.0",
"gulp-less": "3.0.3",
"gulp-sass": "2.3.1",
"gulp-autoprefixer": "2.2.0",
"gulp-minify-css": "1.2.1",
"gulp-typescript": "2.9.2",