Currently, the lessphp library from Leafo.net (http://leafo.net/lessphp/) does not support updated LESS features like extends, a common error I was having. After a bit of research, it seems that leafo.net features are far behind that of gpeasy.com, which is being actively maintained.

I switched it out and it's running beautifully, even using extends. I started writing a drush patch to download the library.

http://lessphp.gpeasy.com
https://github.com/oyejorge/less.php

CommentFileSizeAuthor
#3 oyejorge-compiler-2221237.patch1.82 KBalexkb
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alexkb’s picture

Using the latest bootstrap, I was having lessphp compile errors along the lines of:
Parse error: failed at &:extend(.clearfix all);

As per this issue report on github the gpeasy.com (aka as oyejorge/less.php) does indeed solve this particular problem, so +1 to @kyletaylored's suggestion to switch!

Nilard’s picture

http://lessphp.gpeasy.com/#integration-with-other-projects

This library can be used as drop-in replacement of lessphp to work with Drupal 7 less module.

How to install:

Download the less.php source code and unzip it so that 'lessc.inc.php' is located at 'sites/all/libraries/lessphp/lessc.inc.php'.
Download and install Drupal 7 less module as usual.
That's it :)

This worked for me.

alexkb’s picture

Attached is a patch to update the less modules docs and hook_requirements() with the more reliable LessPHP compiler from gpeasy.

Someone will also need to update the Less module project page too.

alexkb’s picture

Status: Active » Needs review
corey.aufang’s picture

I'm in the process of adding in multi-compiler support.

I will be directing users to visit the project page for a list of compatible compilers and making the hard-coded documentation within the module itself more generic since its easier to make a change to the project page than it is to the module code.

This is related to #2003628: Add ability to use node.js version of LESS.

corey.aufang’s picture

kyletaylored’s picture

Is it really related? It just seems more like a drop-in replacement for the current PHP LESS compiler rather than adding a new kind of compiler. Leafo just isn't being kept up as well as gpeasy.

corey.aufang’s picture

Its related from a code perspective.

I'm changing some of the wrapper code that handles which library to use, and adding support for oyejorge/less.php.

When I had last checked there were issues with complete functional parity between leafo and oyejorge.

I will test again and update the project page to reflect my results.

The update to the project page will not wait until after the update to the module code if everything is working, but it will wait till after I'm not at work.

markhalliwell’s picture

Title: Switch lessphp library from leafo.net to gpeasy.com for better support » Add oyejorge/less.php as default compiler
Version: 7.x-3.0 » 7.x-3.x-dev

I agree, there needs to be support for both (backwards compatible and existing projects that use Leafo/lessphp).

Transitioning from Leafo/lessphp
...
Note, the 'setPreserveComments', 'registerFunction' and 'unregisterFunction' will no longer have any effect on the compiled less.

That being said, it should probably be the default moving forward. FYI, it would probably be beneficial to also add Composer support http://lessphp.gpeasy.com/#installation

corey.aufang’s picture

Spent several hours going through and adding support for oyejorge/less.php, and #2203549.

Ran into an issue that prevent source maps from being generated correctly.

Logged the issue at the following:

https://github.com/oyejorge/less.php/issues/127

Once that issue is resolved, I will be able to complete this functionality.

corey.aufang’s picture

I've also changed the links on the project page to point to http://lessphp.gpeasy.com/#integration-with-other-projects

  • Commit 94c1a48 on 7.x-3.x by corey.aufang:
    Issue #2203549 by corey.aufang: Adding in source maps support.
    Issue #...
corey.aufang’s picture

Documentation pages have also been pointed to oyejorge/less.php.

corey.aufang’s picture

I've updated the information in composer.json to use references to oyejorge/less.php.

I've also attempted to use the following to have the default install path be the libraries folder:

  "extra": {
    "installer-paths": {
      "sites/all/libraries/less.php": ["vendor/package"]
    }
  }

I have yet to get it to actually install to that location.

Is this a Drush only extension or something?

Any help on correctly configuring and testing changes to composer.json would be appreciated.

  • Commit 8677b00 on 7.x-3.x by corey.aufang:
    Issue #2003628 by corey.aufang: lessjs is now run through a class....

  • Commit 94c1a48 on 7.x-3.x, 7.x-4.x by corey.aufang:
    Issue #2203549 by corey.aufang: Adding in source maps support.
    Issue #...
  • Commit 8677b00 on 7.x-3.x, 7.x-4.x by corey.aufang:
    Issue #2003628 by corey.aufang: lessjs is now run through a class....
corey.aufang’s picture

Version: 7.x-3.x-dev » 7.x-4.x-dev
Status: Needs review » Fixed

Marking this as fixed as 7.x-4.0 will be released soon.

Documentation has been updated in the README and on documentation pages.

Composer support has also been updated.

Additionally, support for leafo/lessphp has not been removed.

If there are any other issues with integration between the module and one of the PHP engines, please open a new ticket.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

kingfisher64’s picture

leafo/lessphp is still default despite it not being recommended. Perhaps change default to the library on http://lessphp.gpeasy.com/.

This is in latest stable version.