Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Provide ability to change less compiler, specifically to less.php #53

Merged
merged 1 commit into from
Feb 27, 2014

Conversation

fabrizim
Copy link
Collaborator

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.

Add ability to change compiler with WP_LESS_COMPILER constant
@thom4parisot
Copy link
Owner

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.

thom4parisot pushed a commit that referenced this pull request Feb 27, 2014
Provide ability to change less compiler, specifically to less.php
@thom4parisot thom4parisot merged commit 716d694 into thom4parisot:master Feb 27, 2014
@fabrizim
Copy link
Collaborator Author

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.

@thom4parisot
Copy link
Owner

Cool, that's the way to go :-)

@lkraav
Copy link

lkraav commented Feb 27, 2014

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?

@aibrean
Copy link

aibrean commented Mar 3, 2014

Try https://github.com/bassjobsen/wp-lesscss. That's what I've been using.

@Willem-Siebe
Copy link

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.

@fabrizim
Copy link
Collaborator Author

fabrizim commented Sep 8, 2014

The easiest way is to add a definition to your wp-config.php file. Just add:

define('WP_LESS_COMPILER', 'less.php');

We may update the way this is implemented, but this will still work with the new method.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants