-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
36 lines (29 loc) · 998 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
35
36
var postcss = require('postcss');
function replaceDeclaration(props) {
return function (declaration) {
props.forEach(function (prop) {
declaration.cloneBefore({ prop: prop });
});
declaration.remove();
};
}
module.exports = postcss.plugin('postcss-border-radius', function () {
return function (css) {
css.walkDecls('border-top-radius', replaceDeclaration([
'border-top-right-radius',
'border-top-left-radius'
]));
css.walkDecls('border-right-radius', replaceDeclaration([
'border-top-right-radius',
'border-bottom-right-radius'
]));
css.walkDecls('border-bottom-radius', replaceDeclaration([
'border-bottom-right-radius',
'border-bottom-left-radius'
]));
css.walkDecls('border-left-radius', replaceDeclaration([
'border-top-left-radius',
'border-bottom-left-radius'
]));
};
});