From c1d629c209059ca03f18944f61afad6a0ea84b51 Mon Sep 17 00:00:00 2001 From: David Peter Date: Tue, 14 Apr 2015 12:05:34 -0400 Subject: [PATCH] Allow you to change the compiler and expose it This will let you write sass.compiler.types, for example, and access the sass types without having to require it in your main app. Additionally, this lets you use a forked compiler, or a different branch of the same compiler. --- index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index b692face..d546debf 100644 --- a/index.js +++ b/index.js @@ -4,7 +4,6 @@ var gutil = require('gulp-util'); var through = require('through2'); var assign = require('object-assign'); var path = require('path'); -var sass = require('node-sass'); var applySourceMap = require('vinyl-sourcemaps-apply'); var PLUGIN_NAME = 'gulp-sass'; @@ -117,14 +116,14 @@ var gulpSass = function gulpSass(options, sync) { filePush(obj); }; - sass.render(opts, callback); + gulpSass.compiler.render(opts, callback); } else { ////////////////////////////// // Sync Sass render ////////////////////////////// try { - result = sass.renderSync(opts); + result = gulpSass.compiler.renderSync(opts); filePush(result); } @@ -149,4 +148,9 @@ gulpSass.logError = function logError(error) { gutil.log(gutil.colors.red('[' + PLUGIN_NAME + '] ') + error.message); }; +////////////////////////////// +// Store compiler in a prop +////////////////////////////// +gulpSass.compiler = require('node-sass'); + module.exports = gulpSass;