Skip to content

Commit

Permalink
clean up based on suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielcsapo committed May 26, 2020
1 parent 8a0f41c commit 3e2b319
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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 = {
Expand Down

0 comments on commit 3e2b319

Please sign in to comment.