Skip to content

Commit

Permalink
switch to broccoli-persistent-filter
Browse files Browse the repository at this point in the history
  • Loading branch information
thoov authored and shinnn committed Dec 3, 2015
1 parent e22d849 commit b13e42d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
20 changes: 19 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
var path = require('path');

var CleanCssPromise = require('clean-css-promise');
var Filter = require('broccoli-filter');
var Filter = require('broccoli-persistent-filter');
var inlineSourceMapComment = require('inline-source-map-comment');
var jsonStableStringify = require('json-stable-stringify');

function CleanCSSFilter(inputTree, options) {
if (!(this instanceof CleanCSSFilter)) {
Expand All @@ -25,6 +26,23 @@ CleanCSSFilter.prototype.constructor = CleanCSSFilter;
CleanCSSFilter.prototype.extensions = ['css'];
CleanCSSFilter.prototype.targetExtension = 'css';

CleanCSSFilter.prototype.baseDir = function() {
return __dirname;
};

CleanCSSFilter.prototype.optionsHash = function() {
if (!this._optionsHash) {
this._optionsHash = jsonStableStringify(this.options);
}

return this._optionsHash;
};

CleanCSSFilter.prototype.cacheKeyProcessString = function(string, relativePath) {
return this.optionsHash() +
Filter.prototype.cacheKeyProcessString.call(this, string, relativePath);
};

CleanCSSFilter.prototype.build = function() {
var srcDir = this.inputPaths[0];
var relativeTo = this.options.relativeTo;
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@
"whitespace"
],
"dependencies": {
"broccoli-filter": "^1.2.0",
"broccoli-persistent-filter": "^1.1.6",
"clean-css-promise": "^1.0.0",
"inline-source-map-comment": "^1.0.5"
"inline-source-map-comment": "^1.0.5",
"json-stable-stringify": "^1.0.0"
},
"devDependencies": {
"@shinnn/eslintrc-node": "^1.0.2",
Expand Down

0 comments on commit b13e42d

Please sign in to comment.