How to pass a variable from PHP to LESS?

I use PHP (lessphp) to compile LESS files into CSS files on the server. I would like to pass a variable to a LESS file, like color or language:

compile('input.less?lang=en') 

and use it as a variable in LESS like @lang.

Is it possible? If not, are there any workarounds?

+7
source share
2 answers

This is a built-in lessphp function, here's the documentation: http://leafo.net/lessphp/docs/#setting_variables_from_php

+7
source

I don’t know less or less, so this may not be useful, and you may have already looked at it, but on the site I noticed that someone else asked the same question, and there are several answers:

http://leafo.net/lessphp/#dsq-comment-132897969 (you have to wait until it loads comments from disqus)

It looks like Nico-B has developed a patch for this: https://github.com/Nico-B/lessphp/commit/aacc195fff4ec0075226a29bc832de371a8001ce#diff-1

+3
source

All Articles