--
This commit is contained in:
parent
24f3d27984
commit
6b60015c02
9588 changed files with 1149251 additions and 49 deletions
38
node_modules/rework-visit/index.js
generated
vendored
Normal file
38
node_modules/rework-visit/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
|
||||
/**
|
||||
* Expose `visit()`.
|
||||
*/
|
||||
|
||||
module.exports = visit;
|
||||
|
||||
/**
|
||||
* Visit `node`'s declarations recursively and
|
||||
* invoke `fn(declarations, node)`.
|
||||
*
|
||||
* @param {Object} node
|
||||
* @param {Function} fn
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function visit(node, fn){
|
||||
node.rules.forEach(function(rule){
|
||||
// @media etc
|
||||
if (rule.rules) {
|
||||
visit(rule, fn);
|
||||
return;
|
||||
}
|
||||
|
||||
// keyframes
|
||||
if (rule.keyframes) {
|
||||
rule.keyframes.forEach(function(keyframe){
|
||||
fn(keyframe.declarations, rule);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// @charset, @import etc
|
||||
if (!rule.declarations) return;
|
||||
|
||||
fn(rule.declarations, node);
|
||||
});
|
||||
};
|
||||
Loading…
Reference in a new issue