Skip to content

Commit 034ab59

Browse files
committedMar 26, 2018
feat: add basic pipe addon
1 parent a08dbc9 commit 034ab59

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
 

‎addon/pipe.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
'use strict';
2+
3+
var addonCssom = require('./cssom').addon;
4+
5+
exports.addon = function (renderer) {
6+
if (!renderer.putRule) {
7+
addonCssom(renderer);
8+
}
9+
10+
if (process.env.NODE_ENV !== 'production') {
11+
require('./__dev__/warnOnMissingDependencies')('pipe', renderer, ['putRule']);
12+
}
13+
14+
renderer.pipe = function (initialDecls) {
15+
var className = 'a';
16+
var rule = renderer.putRule('.' + className);
17+
18+
for (var prop in initialDecls) {
19+
rule.style.setProperty(prop, initialDecls[prop]);
20+
}
21+
22+
var closure = function (decls) {
23+
for (var prop in decls) {
24+
rule.style.setProperty(prop, decls[prop]);
25+
}
26+
27+
return ' ' + className;
28+
};
29+
30+
return closure;
31+
};
32+
};

0 commit comments

Comments
 (0)