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
Post a Comment