Provide ability to change less compiler, specifically to less.php#53
Provide ability to change less compiler, specifically to less.php#53thom4parisot merged 1 commit intothom4parisot:masterfrom
Conversation
Add ability to change compiler with WP_LESS_COMPILER constant
|
Great addition and thanks for proposing it. That's fine for me. An even future-proof version would be to be able to inject any Less compiler class so people could eventually use an older version of less (or their own flavour). Also, as I'm almost in the same case as leafo, I no longer have time to maintain wp-less so if you and other people want to take over it, I'm fine with that. |
Provide ability to change less compiler, specifically to less.php
|
I will try help maintain this project as much as possible, but time is always an issue. I will probably still propose new code as Pull Requests and leave it up for a day or two to see if anyone has any comments. If not, I'll assume that its okay :) The one thing that I need your help with is creating the WP Plugin repo packages. FYI - this commit will allow for any compiler as long as it is wrapped in a class named "lessc". The WP_LESS_COMPILER constant can be defined as a file (that contains the lessc class), a directory (that contains a file named 'lessc.inc.php') or the string 'less.php', as that is now included in this repo. |
|
Cool, that's the way to go :-) |
|
Since resource is totally scarce, but this toolset is of great importance, may I suggest merging efforts with https://github.com/sanchothefat/wp-less? I'm not even sure at this point if oncletom's has any features over sancho's. Perhaps we could find this out together. What I can see is that sancho's implementation is simpler and cleaner. Thoughts? |
|
Try https://github.com/bassjobsen/wp-lesscss. That's what I've been using. |
|
So, with this commit I can choose for less.php? Can you please update the FAQ (https://wordpress.org/plugins/wp-less/faq/) or docs here on Github, I don't know how I can change it to use less.php, please help. |
|
The easiest way is to add a definition to your wp-config.php file. Just add: We may update the way this is implemented, but this will still work with the new method. |
The leafo/lessphp branch is no longer actively maintaned. As such, the latest features of the less compiler are missing (eg. the extend keyword). This becomes an issue when working with frameworks that take advantage of these new language constructs. Bootstrap > 3.0.0 will not compile with lessphp (leafo/lessphp#535). This issue has been hanging around for a while now, but no progress has been made.
This Pull Request addresses this issue by allowing the ability to use the 'lessc.inc.php' that is now part of the less.php project to provide compatability with lessphp projects. It allows the choice of compiler through a constant that can be added to the wp-config.php file, WP_LESS_COMPILER.
The options for this variable are "less.php", which will include the above mentioned include. Since this is the primary (only?) alternative right now, it is included as a submodule in the same 'vendor' directory as lessphp.
The issues with using the different compiler are 1) performance and 2) no support for php defined functions added via registerFunction.
For backwards compatibility I think this should be an opt-in on behalf of the developer at this point because if they are currently using the registerFunction feature of less.php, it will break their theme.