Skip to content

Commit d928067

Browse files
author
Ashesh Vidyut
committed
refactor code
1 parent dbbeb94 commit d928067

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

index.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
const _ = require('lodash/fp');
22
const postCss = require('postcss');
33

4+
const keyFramesParent = ['keyframes', '-webkit-keyframes', '-moz-keyframes'];
5+
46
const postCssWrapperPlugin= postCss.plugin('postcss-wrapper-plugin', function(prefix) {
57
return function(css) {
68
css.walkRules(function(rule) {
7-
if (_.isEqual(_.get('parent.name', rule), 'keyframes'))
8-
return;
9-
if (_.isEqual(_.get('parent.name', rule), '-webkit-keyframes'))
10-
return;
11-
if (_.isEqual(_.get('parent.name', rule), '-moz-keyframes'))
12-
return;
9+
let parentName = _.get('parent.name', rule);
10+
if (_.includes(parentName, keyFramesParent))
11+
return;
1312

1413
const selector = rule.selector;
1514
rule.selector = _.pipe(_.split(','), _.map(_.pipe(_.trim, joinPrefix(prefix))),

0 commit comments

Comments
 (0)