Files
less.js/test/less/plugin/plugin-preeval.js
Calvin Juárez d54251276a Plugins: If minVersion >= 3.0.0, don't "pre-run" .setOptions() (#3247)
* dev – add .editorconfig
* AbstractPluginLoader – check for minVersion < 3 before running .setOptions() twice
* tests – separate unspecified minVersion test from minVersion: [2,0,0] test
2018-07-02 19:45:29 -07:00

28 lines
695 B
JavaScript

module.exports = {
install({ tree: { Quoted }, visitors }, manager) {
class Visitor {
constructor() {
this.native = new visitors.Visitor(this);
this.isPreEvalVisitor = true;
this.isReplacing = true;
}
run(root) {
return this.native.visit(root);
}
visitVariable(node) {
if (node.name === '@replace') {
return new Quoted(`'`, 'bar', true);
}
return node;
}
}
manager.addVisitor(new Visitor());
// console.log(manager);
},
minVersion: [2,0,0]
};