diff --git a/index.js b/index.js index 2739f33..1622305 100644 --- a/index.js +++ b/index.js @@ -11,6 +11,9 @@ const fs = require('fs'); const includePathSearcher = require('include-path-searcher'); class SassCompiler extends Filter { + extensions = ['scss', 'sass']; + targetExtension = 'css'; + constructor(inputTree, inputOutputMap, _options) { let options = _options || {}; if (!options || typeof options !== 'object') { @@ -94,7 +97,7 @@ class SassCompiler extends Filter { */ rethrowBuildError(error) { if (typeof error === 'string') { - throw new Error('[string exception] ' + error); + throw new Error('ember-cli-sass: [string exception] ' + error); } else { error.type = 'Sass Syntax Error'; error.message = error.formatted; @@ -108,9 +111,6 @@ class SassCompiler extends Filter { } } -SassCompiler.prototype.extensions = ['scss', 'sass']; -SassCompiler.prototype.targetExtension = 'css'; - function SASSPlugin(optionsFn) { this.name = 'ember-cli-sass'; this.optionsFn = optionsFn; @@ -160,17 +160,18 @@ SASSPlugin.prototype.toTree = function(tree, inputPath, outputPath, inputOptions return { input, output }; }); - var trees = [ - new SassCompiler(new Funnel(mergeTrees(inputTrees), { - include: ['**/*.scss', '**/*.sass', '**/*.css'], - }), inputOutputMap, options) - ]; + const compileSassTree = new SassCompiler(new Funnel(mergeTrees(inputTrees), { + include: ['**/*.scss', '**/*.sass', '**/*.css'], + }), inputOutputMap, options); if (options.passthrough) { - inputTrees.push(new Funnel(tree, options.passthrough)); + return mergeTrees([ + new Funnel(tree, options.passthrough), + compileSassTree, + ], { overwrite: true }) } - return mergeTrees(trees, { overwrite: true }); + return compileSassTree; }; module.exports = {