diff --git a/scripts/compile-sass.js b/scripts/compile-sass.js index d6dd9b7cd8..8a42c2efeb 100644 --- a/scripts/compile-sass.js +++ b/scripts/compile-sass.js @@ -2,9 +2,9 @@ var gulp = require('gulp-help')(require('gulp')); var sass = require('gulp-sass'); -var path = require("path"); var sourcemaps = require('gulp-sourcemaps'); var config = require('../build.conf'); +var sassImporter = require('./sass-importer'); gulp.task('compile-sass', 'Build the module styles', function() { return gulp @@ -12,13 +12,7 @@ gulp.task('compile-sass', 'Build the module styles', function() { //.pipe(sourcemaps.init()) // add later on when not using relative routes for node_modules scss .pipe(sass({ errLogToConsole: true, - importer: function(url, prev, done) { - if (url.indexOf('~') === 0) { - url = 'node_modules/' + url.substring(1, url.length); - return {file: path.relative(path.dirname(prev), url)}; - } - return {file: url}; - } + importer: sassImporter, })) .pipe(sourcemaps.write('.')) .pipe(gulp.dest('deploy/')); diff --git a/scripts/sass-importer.js b/scripts/sass-importer.js new file mode 100644 index 0000000000..1cc60b9d05 --- /dev/null +++ b/scripts/sass-importer.js @@ -0,0 +1,9 @@ +var path = require("path"); + +module.exports = function sassImporter(url, prev, done) { + if (url.indexOf('~') === 0) { + url = 'node_modules/' + url.substring(1, url.length); + return {file: path.relative(path.dirname(prev), url)}; + } + return {file: url}; +} \ No newline at end of file