How to use the render function from less
Find comprehensive JavaScript less.render code examples handpicked from public code repositorys.
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
+ 11 other calls in file
GitHub: putaoshu/jdf
63 64 65 66 67 68 69 70 71 72
return; } if($.is.less(source) && jdf.config.build.less){ try{ Less.render(sourceContent, {filename: source, syncImport:true}, function(error, output){ if(error){ console.log(error); }else{ var targetContent = output.css;
160
614
56
+ 3 other calls in file
GitHub: thumbsup/thumbsup
107 108 109 110 111 112 113 114 115 116
const customInclude = this.customStylesInclude() // now render both together const lessOptions = { paths: [this.dir] } less.render(themeLess + customInclude, lessOptions, (err, output) => { if (err) return done(err) const filename = this.opts.stylesheetName || 'theme.css' const dest = path.join(this.dest, 'public', filename) fs.mkdirpSync(path.join(this.dest, 'public'))
82
657
20
+ 3 other calls in file
195 196 197 198 199 200 201 202 203 204
filename: lessPath, paths: options.preprocess.importPaths(options.render.paths, req) }); lessSrc = options.preprocess.less(lessSrc, req); less.render(lessSrc, renderOptions, function(err, output){ if (err) { utilities.lessError(err); return next(err); }
77
269
10
+ 3 other calls in file
87 88 89 90 91 92 93 94 95 96
const isProductionEnv = process.env.NODE_ENV === 'production'; const processLess = function(context, payload) { return new Promise(( resolve, reject ) => { less.render({ file: context }, function(err, result) { if( !err ) { resolve(result);
52
233
4
+ 7 other calls in file
GitHub: qlik-oss/leonardo-ui
129 130 131 132 133 134 135 136 137 138
function compileLess() { const lessContent = fs.readFileSync(path.resolve(docsDir, 'src/docs.less'), { encoding: 'utf8', }); less.render( lessContent, { paths: [path.resolve(__dirname, '../src')], filename: 'docs.css',
25
78
34
+ 3 other calls in file
63 64 65 66 67 68 69 70 71 72
process.stdin.resume(); process.stdin.setEncoding('utf8'); process.stdin.on('data', function (less_css) { less.render(less_css, function(e, css){ console.log(css) }); }); """
22
61
6
+ 3 other calls in file
GitHub: everlose/nodePractice
124 125 126 127 128 129 130 131 132 133
res.end(err.message); return; } var contentText = fs.readFileSync(path); less.render(contentText.toString(), { filename: path }, function(e, output) { if (e) { res.end(self.showError(e));
18
56
4
+ 3 other calls in file
76 77 78 79 80 81 82 83 84 85
return locals; } export default async function processLess(source, rootPath, filePath, camelCase, modulePath) { try { const lessResult = await less.render(source, { sourceMap: { outputSourceFiles: true }, relativeUrls: true,
1
10
2
+ 3 other calls in file
33 34 35 36 37 38 39 40 41
} }; }; async function compileLess (file, minify) { return less.render(await fs.readFileAsync(file, 'utf8'), { filename: file, strictMath: true }).then((output) => { return minify ? minifyCss(output.css) : output.css; }); }
65
0
1
GitHub: Linkontoask/radishes
36 37 38 39 40 41 42 43 44 45
} const lessSource = `.css { ${content} }` let { css } = await less.render(lessSource) css = css.split('\n') content = '' for (let i = 0; i < css.length; i++) {
27
214
5
+ 3 other calls in file
GitHub: jaredly/demobox
19 20 21 22 23 24 25 26 27
main: main[i], accent: accent[i], accentLight: accentLight[i] }) var name = names[i].toLowerCase().replace(' ', '-') less.render(text, { paths: ['.'], compress: true, filename: name }, save.bind(null, '../build/themes/' + name + '.css')) }
5
35
5
+ 3 other calls in file
GitHub: stolksdorf/vitreum
10 11 12 13 14 15 16 17 18 19
const transform = (code, fp, opts)=>imports.add(fp); transform.generate = async (dev=false)=>{ clearLessCache(); const lessCode = Array.from(imports).reverse().map((fp)=>`@import (less) "${fp}";`).join('\n'); return await LessLib.render(lessCode, { compress : !dev, sourceMap : (dev ? { sourceMapFileInline: true, outputSourceFiles: true
13
11
4
GitHub: versionone/wess
24 25 26 27 28 29 30 31 32 33
function read(done) { fs.readFile(path, 'utf8', done); } // Compile the source. // Use the less.render() promise interface because the regular one appears // to occasionally call the callback multiple times. function compile(source, done) { less.render(source, opts) .then(function(output) { done(null, output); },
1
0
44
+ 11 other calls in file
GitHub: drsounds/liberal
95 96 97 98 99 100 101 102 103 104
darkTheme = darkTheme.replace(/\@secondary-color/, settings.secondaryColor); darkTheme = darkTheme.replace("@islight", true ? '@light' : '@dark'); darkTheme = darkTheme.replace("@isdark", !true ? '@light' : '@dark'); //alert(theme); less.render(lightTheme, {}, function (error, output) { console.log(error, output); //alert(output); fs.writeFileSync(process.env.PWD + '/themes/' + settings.theme + '/css/light.css', output.css); });
0
6
3
+ 7 other calls in file
GitHub: tcurdt/xstatic
18 19 20 21 22 23 24 25 26 27
}, defaults) const collection = new Xstatic.collection('less', [ files ], options) function less(file, doc, resolver) { return Less.render(doc.body.data.toString(), _.merge(options.less, { plugins: [ resolver ], filename: Path.resolve(file.path), relativeUrls: false, })).then(function(result) {
2
2
2
GitHub: serendipityApe/fect
24 25 26 27 28 29 30 31 32 33
}, } const compileLess = async (filePath) => { const source = await readFile(filePath, 'utf8') const { css } = await render(source, { filename: filePath, plugins: [TildeResolverPlugin], }) return css
46
0
0
67 68 69 70 71 72 73 74 75 76
// process less content let processed; try { processed = await less.render(input, options); } catch (error) { console.log( `[${blue('.scripts/less')}] ${red( 'An error occurred while processing styles'
0
1
1
+ 6 other calls in file
223 224 225 226 227 228 229 230 231 232 233
files: scripts, }, fork); }; actions.buildCSS = async function buildCSS(data) { const lessOutput = await less.render(data.source, { paths: data.paths, javascriptEnabled: false, });
1
0
5
+ 3 other calls in file
GitHub: llleeeaaannn/bohsforum
238 239 240 241 242 243 244 245 246 247
async function saveRenderedCss(data) { if (!data.customCSS) { return; } const less = require('less'); const lessObject = await less.render(data.customCSS, { compress: true, javascriptEnabled: false, }); data.renderedCustomCSS = lessObject.css;
0
0
1
less.render is the most popular function in less (129 examples)