Skip to content

Commit

Permalink
Merge pull request #140 from dmfenton/onlyIncluded
Browse files Browse the repository at this point in the history
Add option to use only app/styles and includePath
  • Loading branch information
simonexmachina authored Oct 19, 2016
2 parents a853478 + ccefdc1 commit 999dc9f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ var app = new EmberApp({
```

- `includePaths`: an array of include paths
- `onlyIncluded`: true/false whether to use only what is in app/styles and includePaths. Helps with performance when using NPM linked modules
- `sourceMap`: controls whether to generate sourceMaps, defaults to `true` in development. The sourceMap file will be saved to `options.outputFile + '.map'`
- `extension`: specifies the file extension for the input files, defaults to `scss`. Set to `sass` if you want to use `.sass` instead.
- `nodeSass`: Allows a different version of [node-sass](https://www.npmjs.com/package/node-sass) to be used (see below)
Expand Down
13 changes: 12 additions & 1 deletion 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('broccoli-funnel');
var mergeTrees = require('broccoli-merge-trees');
var merge = require('merge');
var fs = require('fs');
Expand All @@ -13,8 +14,18 @@ function SASSPlugin(optionsFn) {

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

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

var inputTrees = [tree];
if (options.includePaths) {
inputTrees = inputTrees.concat(options.includePaths);
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
],
"dependencies": {
"broccoli-merge-trees": "^1.1.0",
"broccoli-funnel": "^1.0.0",
"broccoli-sass-source-maps": "^1.8.0",
"ember-cli-babel": "5.1.10",
"ember-cli-version-checker": "^1.0.2",
Expand Down

0 comments on commit 999dc9f

Please sign in to comment.