Description
I'm Writing a ThemeColor Plugin, use Visitor.
In fn:visitColor , node.parent sometimes is null (box-shadow:0 0 0 1px #999 inset). I can't find the parent Declaration Node of Color Node.
so I want to less.js/lib/less/visitors/visitor.js Visitor.prototype.visit, funcOut.call(impl, node); => funcOut.call(impl, node, visitArgs);.
And my Code will be like this.
class ThemeVisitor {
visitDeclaration(node, visitArgs) {
node.isColorDeclaration = false;
visitArgs.isColorDeclaration = false;
return node;
}
visitColor(node, visitArgs) {
visitArgs.isColorDeclaration = true;
return node;
}
visitDeclarationOut(node, visitArgs) {
if (visitArgs.isColorDeclaration) {
node.isColorDeclaration = true;
}
return node;
}
visitRulesetOut(node) {
node.rules = node.rules.filter((item) => {
if (item instanceof Declaration) {
return item.isColorDeclaration;
}
if (item instanceof Ruleset) {
return !!item.rules.length;
}
});
return node;
}
}
Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

Activity