-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
34 lines (27 loc) · 839 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
'use strict';
var objectAssign = require('object-assign');
var Filter = require('broccoli-filter');
var Rework = require('rework');
function ReworkFilter(inputTree, opts) {
if (!(this instanceof ReworkFilter)) {
return new ReworkFilter(inputTree, opts);
}
this.inputTree = inputTree;
this.opts = opts || {};
}
ReworkFilter.prototype = Object.create(Filter.prototype);
ReworkFilter.prototype.constructor = ReworkFilter;
ReworkFilter.prototype.extensions = ['css'];
ReworkFilter.prototype.targetExtension = 'css';
ReworkFilter.prototype.processString = function (str, relativePath) {
var rework = new Rework(str, {
source: relativePath
});
if (this.opts.use) {
this.opts.use(rework);
}
return rework.toString(this.opts);
};
module.exports = ReworkFilter;
delete Rework.properties;
objectAssign(module.exports, Rework);