This commit is contained in:
root
2023-03-29 15:20:05 +00:00
parent 5ec489e0e0
commit a0bb8f2d1e
25468 changed files with 3063105 additions and 28 deletions

View File

View File

@@ -0,0 +1,8 @@
# rework-visit
Rework declaration visitor for plugins (and rework core).
# License
MIT

View File

@@ -0,0 +1,9 @@
{
"name": "rework-visit",
"repo": "visionmedia/rework-visit",
"version": "1.0.0",
"description": "Rework declaration visitor utility",
"keywords": ["css", "rework"],
"license": "MIT",
"scripts": ["index.js"]
}

View 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);
});
};

View File

@@ -0,0 +1,7 @@
{
"name": "rework-visit",
"version": "1.0.0",
"description": "Rework declaration visitor utility",
"keywords": ["css", "rework"],
"license": "MIT"
}