less-plugins

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

╄→尐↘猪︶ㄣ 提交于 2019-12-13 03:59:50
问题 I tried the following: module.exports = function(less) { function RemoveProperty() { this._visitor = new less.visitors.Visitor(this); }; RemoveProperty.prototype = { isReplacing: true, isPreEvalVisitor: true, run: function (root) { return this._visitor.visit(root); }, visitRule: function (ruleNode, visitArgs) { if(ruleNode.name[0].value != '-some-aribitrary-property') { return ruleNode; } else { return new less.tree.Rule([], [], 0,""); } } }; return RemoveProperty; }; return new less.tree

How to exend the Less compiler with a custom function leveraging a plugin

跟風遠走 提交于 2019-11-28 01:27:58
Since version 2 of Less you can use plugins . You can also use these plugins to add custom function to Less, examples: https://github.com/less/less-plugin-advanced-color-functions/ and https://github.com/bassjobsen/less-plugin-cubehelix Inspired on https://github.com/less/less.js/issues/2341 i want to add a custom function twotimesandten to less, so that: @start: 10; .test { result: twotimesandten(@start); } compiles into: .test { result: 30; } After reading http://lesscss.org/usage/#plugins-for-plugin-authors , i wonder how to do this? First write the plugin for usage in the browser . You

How to exend the Less compiler with a custom function leveraging a plugin

偶尔善良 提交于 2019-11-27 04:43:53
问题 Since version 2 of Less you can use plugins. You can also use these plugins to add custom function to Less, examples: https://github.com/less/less-plugin-advanced-color-functions/ and https://github.com/bassjobsen/less-plugin-cubehelix Inspired on https://github.com/less/less.js/issues/2341 i want to add a custom function twotimesandten to less, so that: @start: 10; .test { result: twotimesandten(@start); } compiles into: .test { result: 30; } After reading http://lesscss.org/usage/#plugins