-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
41 lines (29 loc) · 1.04 KB
/
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
35
36
37
38
39
40
41
var postcss = require('postcss');
module.exports = postcss.plugin('postcss-ie9-flex-to-display-inline-block', function (opts) {
opts = opts || {};
// Work with options here
return function (root, result) {
var conglomerate_ie_9_rule = postcss.rule();
conglomerate_ie_9_rule.selector = '';
conglomerate_ie_9_rule.nodes = [
{
type: 'decl',
prop: 'display',
value: 'inline-block'
}
];
root.walkRules(function (rule) {
rule.walkDecls(function (decl, i) {
if ( 'flex' === decl.value) {
var current_selector = rule.selector;
var separator = ',';
if ( conglomerate_ie_9_rule.selector == '') {
separator = '';
}
conglomerate_ie_9_rule.selector += separator + '.ie9 ' + current_selector;
}
});
});
root.append(conglomerate_ie_9_rule);
};
});