How to use the less.tree function in less

To help you get started, we’ve selected a few less examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ixrock / grunt-less2js / tasks / less2js.js View on Github external
parser.parse(content, function (err, tree) {
          var env = new less.tree.evalEnv();
          var ruleset = tree.eval(env); // jshint ignore:line

          ruleset.rules.forEach(function (rule) {
            if (rule.variable) {
              var name = rule.name.substr(1); // remove "@"
              var value = rule.value.value[0]; // can be less.tree.Color, less.tree.Expression, etc.
              lessVars[name] = value.toCSS();
            }
          });
        });
      });
github less / less.js / lib / less / adapters / server.js View on Github external
var path = require('path');

require.paths.unshift(path.join(__dirname, '..', '..'));

var less = require('less');

process.mixin(less,        require('less/parser'));
process.mixin(less.tree,   require('less/tree'));
process.mixin(exports, less);

require('ext/array');
github dpricha89 / cloudsu / node_modules / grunt-contrib-less / tasks / less.js View on Github external
Object.keys(options.customFunctions).forEach(function(name) {
          less.tree.functions[name.toLowerCase()] = function() {
            var args = [].slice.call(arguments);
            args.unshift(less);
            var res = options.customFunctions[name].apply(this, args);
            return typeof res === "object" ? res : new less.tree.Anonymous(res);
          };
        });
      }
github ecomfe / node-lesslint / lib / LesslintVisitor.js View on Github external
/**
 * @file LesslintVisitor 基类
 *       这个类里会遍历 less ast 的 rules ,根据 rule 的类型去加载 lint 目录下不同的检测文件
 * @author ielgnaw(wuji0223@gmail.com)
 */

var path = require('path');
var fs = require('fs');
var tree = require('less').tree;

var util = require('./util');

/**
 * 解析需要检测的规则配置,生成真正需要检测的配置
 * 会把不需要检测的配置从 me.detectConfigs 中过滤掉,需要检测的换成 lint 文件里的 exports
 *
 * @return {Object} 真正需要检测的配置
 */
function analyzeConfigs() {
    var ret = {};
    var me = this;
    fs.readdirSync(
        path.join(__dirname, 'rule')
    ).forEach(
        function (fileName) {
github ExactTarget / fuelux / node_modules / grunt-recess / node_modules / recess / lib / compile / prefix-whitespace.js View on Github external
module.exports.on = function () {
  toCSS = less.tree.Ruleset.prototype.toCSS
  less.tree.Ruleset.prototype.toCSS = compile
}
github ExactTarget / fuelux / node_modules / grunt-recess / node_modules / recess / lib / compile / prefix-whitespace.js View on Github external
module.exports.on = function () {
  toCSS = less.tree.Ruleset.prototype.toCSS
  less.tree.Ruleset.prototype.toCSS = compile
}
github chrisekelley / coconut / node_modules / grunt-contrib-less / tasks / less.js View on Github external
less.functions.functionRegistry.add(name.toLowerCase(), function() {
          var args = [].slice.call(arguments);
          args.unshift(less);
          var res = options.customFunctions[name].apply(this, args);
            return typeof res === 'object' ? res : new less.tree.Anonymous(res);
        });
      });
github UniversalViewer / universalviewer / build / theme.js View on Github external
less.functions.functionRegistry.add(name.toLowerCase(), function() {
                    var args = [].slice.call(arguments);
                    args.unshift(less);
                    var res = options.customFunctions[name].apply(this, args);
                    return typeof res === 'object' ? res : new less.tree.Anonymous(res);
                });
            });
github Leeft / Star-Citizen-WebGL-Map / node_modules / grunt-contrib-less / tasks / less.js View on Github external
less.tree.functions[name.toLowerCase()] = function() {
            var args = [].slice.call(arguments);
            args.unshift(less);
            var res = options.customFunctions[name].apply(this, args);
            return typeof res === "object" ? res : new less.tree.Anonymous(res);
          };
        });