I use PHP (lessphp) to compile LESS files into CSS files on the serverside. I would like to pass a variable to the LESS file, like a color or a language:
compile('input.less?lang=en')
and use it as a variable in LESS like @lang.
Is this possible? If not, are there any workarounds?
What does $$ (dollar dollar or double dollar) means in PHP ? The $x (single dollar) is the normal variable with the name x that stores any value like string, integer, float, etc. The $$x (double dollar) is a reference variable that stores the value which can be accessed by using the $ symbol before the $x value.
The Scope Resolution Operator (also called Paamayim Nekudotayim) or in simpler terms, the double colon, is a token that allows access to static, constant, and overridden properties or methods of a class.
This is a built in feature of lessphp, here's the documentation: http://leafo.net/lessphp/docs/#setting_variables_from_php
I don't know less or lessphp so this may not be helpful and you may have already looked at it, but on the site I notice someone else has asked the same question and there are a couple of responses:
http://leafo.net/lessphp/#dsq-comment-132897969 (You'll have to wait for it to load the comments from disqus)
It looks like Nico-B has developed a patch to do this: https://github.com/Nico-B/lessphp/commit/aacc195fff4ec0075226a29bc832de371a8001ce#diff-1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With