Skip to content

Commit

Permalink
Add option to use only app/styles and includePath
Browse files Browse the repository at this point in the history
Putting this here for discussion as it can help with adopted-ember-addons#74.

This PR adds a new option `onlyIncluded` which allows the user to prune the style tree down to just app/styles and anything in the `includePaths` array. This helps performance because the broccoli-caching-writer no longer has to stat everything in the addon trees (via walk-sync).  The speedup is especially pronounced when using linked modules because those trees can get very large.
  • Loading branch information
Daniel Fenton committed Oct 10, 2016
1 parent a853478 commit e697f17
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var SassCompiler = require('broccoli-sass-source-maps');
var path = require('path');
var checker = require('ember-cli-version-checker');
var Funnel = require('broccli-funnel')
var mergeTrees = require('broccoli-merge-trees');
var merge = require('merge');
var fs = require('fs');
Expand All @@ -13,8 +14,14 @@ function SASSPlugin(optionsFn) {

SASSPlugin.prototype.toTree = function(tree, inputPath, outputPath, inputOptions) {
var options = merge({}, this.optionsFn(), inputOptions);

var inputTrees = [tree];
var inputTrees

if (inputOptions.onlyIncluded) {
inputTrees = [new Funnel('app/styles', {destDir: 'app/styles'})];
} else {
inputTrees = [tree];
}

if (options.includePaths) {
inputTrees = inputTrees.concat(options.includePaths);
}
Expand Down

0 comments on commit e697f17

Please sign in to comment.