node.js - LESS modifyVars in nodejs -


i'm trying create 1 less stylesheet, multiple css file, different names according variable value. less modifyvars function seems run in browser enviroment. so, possible use less modifyvars function in nodejs?

you're right, modifyvars available in browser.js loaded (as name suggests) in browser.

with node, can achieve same result prepending string containing variables wish modify. here short example:

var less = require('less');  var css = '.class { color: @color };';  ['red', 'blue', 'yellow'].foreach(function(color, index){   var settings = '@color: ' + color + ';';   less.render(settings + css, function (e, css) {     console.log('script ' + index + ':')     console.log(css);     console.log('----')   }); }); 

this should give same results modifyvars.


Comments

Popular posts from this blog

codeigniter - Fatal error: Call to undefined function lang() in CI Merchant using CardSave -

python - Received unregistered task using Celery with Django -

c# - Delving into the world of XML (Windows Phone) Error I dont understand (The ' ' character, hexadecimal value 0x20, cannot be included in a name.) -