-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
32 lines (21 loc) · 817 Bytes
/
Copy pathindex.js
File metadata and controls
32 lines (21 loc) · 817 Bytes
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
var postcss = require('postcss');
var rulesetKeyframes = function rulesetKeyframes() {
return function(css) {
var cloned;
// finds all keyframes rules using regex
css.walkAtRules(/(keyframes)$/, function(rule) {
// if the keyframe parent is not the root of the file
// then the keyframe animation needs
// to be moved to the end of the file
if (rule.parent.type !== 'root') {
// here clone rule
cloned = rule;
// remove original rule
rule.remove();
// insert cloned rule at the bottom of the stylesheet
css.append(cloned);
}
});
};
};
module.exports = postcss.plugin('postcss-mq-keyframes', rulesetKeyframes);