How to use less.Parser:
146 147 148 149 150 151 152 153 154 155
options.render = options.render || function(str, lessPath, cssPath, callback) { var paths = [ path.dirname(lessPath) ]; options.paths.forEach(function(p){ paths.push(p); }); var parser = new less.Parser({ paths: paths, filename: lessPath, optimization: options.optimization, dumpLineNumbers: options.dumpLineNumbers
How to use less.FileManager:
GitHub: tcurdt/xstatic
37 38 39 40 41 42 43 44 45 46
collection.build = function(create) { return _.collect(function(add) { const resolver = { install: function(_less, pluginManager) { const fm = new Less.FileManager() fm.loadFile = function(path, dir, loadOptions, env, cb) { return new Promise(function(resolve, reject){ const pathRel = Path.join(_.stripBasedir(process.cwd(), dir), path)
How to use less.middleware:
141 142 143 144 145 146 147 148 149 150
if (options.cacheFile && !cacheFileInitialized) { initCacheFile(options.cacheFile, log); } // Expose for testing. less.middleware._saveCacheToFile = _saveCacheToFile; // Actual middleware. return function(req, res, next) { if ('GET' != req.method.toUpperCase() && 'HEAD' != req.method.toUpperCase()) { return next(); }
77
269
10
See more examples
How to use less.tree:
20 21 22 23 24 25 26 27 28 29
function absolute(imported, asset){ return path.resolve(path.dirname(imported), asset); } function patchImport(less){ var Import = less.tree.Import; less.tree.Import = function(path, features, options, index, currentFileInfo){ options.less = true; options.inline = false; this.options = options;
How to use less.render:
83 84 85 86 87 88 89 90 91 92
})(`./build/themes/V3/${dir}/style.css`); } await fs.outputFile('./themes/themes.json', JSON.stringify(themes, null, 2)); // await less.render(lessCode, { // compress : !dev, // sourceMap : (dev ? { // sourceMapFileInline: true, // outputSourceFiles: true
294
882
36
See more examples