Thursday 15 April 2010

Howto remove a entry from the tree in a Less visitor plugin -



Howto remove a entry from the tree in a Less visitor plugin -

i tried following:

module.exports = function(less) { function removeproperty() { this._visitor = new less.visitors.visitor(this); }; removeproperty.prototype = { isreplacing: true, ispreevalvisitor: true, run: function (root) { homecoming this._visitor.visit(root); }, visitrule: function (rulenode, visitargs) { if(rulenode.name[0].value != '-some-aribitrary-property') { homecoming rulenode; } else { homecoming new less.tree.rule([], [], 0,""); } } }; homecoming removeproperty; };

return new less.tree.rule([], [], 0,""); still result in empty output : ; homecoming nil give me error: typeerror: cannot read property 'splice' of undefined.

it can.. not ideal performance perspective.. homecoming empty array

visitrule: function (rulenode, visitargs) { if (rulenode.variable) { homecoming []; } homecoming rulenode; },

if check out tocss visitor alot.

but think should allow undefined too.. @ adding soon.

less less-plugins

No comments:

Post a Comment