-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Set LESS-Variables in PHP #17
Comments
Handling multidimensional option arrays, dealing with variable name collisions, keeping options from breaking LESS in the context of mixin arguments - there are a lot of ins and outs to this issue. I'm not sure any one convention will ever meet all needs that are tempting you with this functionality, so it might just be best left up to PHP. I've accomplished passing PHP vars to the LESS compiler by parsing an options array and generating a LESS snippet with all of my LESS variable definitions, adding it to the front of my LESS file (read into PHP not through |
This feature will be very nice, I am designing a website with base color and every other color is depending in this color with lighten() and darken() functions, It will be very powerful if i can give the user the ability to change the base color so he can change all other colors. |
http://leafo.net/lessphp/docs/#setting_variables_from_php It works a little bit differently than described, it doesn't overwrite variables in the top scope. Something which I think I should change. |
Right at the moment the Compilation-Interface only allows to enter an input and an output filename. Wouldn't it be nice also to be able to pass parameters as an array, which can be used as variables in LESS? This could e.g. allow to easily include features like allowing a user to set a custom background-color or setting a custom font size. (Especially if you use the symfony-Plugin this would be a powerful feature)
At the moment you could only get such a behavior it you write a LESS-File which defines variables in PHP to the filesystem and then import that with your base file. But this is difficult to use, especially if you want to use several versions of a CSS-file at a time.
The easiest behavior for using this feature would be, that variables in the LESS-File would simply be overwritten. So - to not cause errors without PHP-parameters - default parameters can be set in the LESS-file which will be used, when no parameters are passed. Maybe you could also think of an "important!" for variable definition which would protect a variable of overwriting, but this would not be a necessary feature in my eyes.
PHP:
LESS:
Compiled CSS:
The text was updated successfully, but these errors were encountered: