I've tried enabling the module on a site in development. When it didn't process the .less file, I created a test site. On the test site I installed core, less and admin_menu only. I enabled both admin_menu and less.

I created a theme called 'less_test'.
less_test.info:

name = "less"
description = "Less test theme"
core = 6.x
stylesheets[all][] = less_test.less

less_test.less:

@grey: #777;
body {
  background: @grey;
}

I've cleared cache (with drush) and reloaded the page. The presulting page however has the unprocessed less file linked as a stylesheet instead of proper css output. Have a missed a step needed to get the preprocessing to work?

CommentFileSizeAuthor
#6 less.patch1.28 KBcorey.aufang

Comments

corey.aufang’s picture

Is your files directory writable?

TimeRaider’s picture

I have the same problem on GoDaddy's Shared-Linux account. Altho everything works perfect on XAMPP on Windows 7.

andb’s picture

Yes, the files dir is writable. Testing locally on Ubuntu 10.04. Based on that question I looked into the files dir and /sites/default/files/less/sites/all/themes/less_test/less_test.css is being created and is correct. So what isn't happening is that in the final rendered page the stylesheet link with the .less extension isn't being replaced with the compiled css from the files directory.

andb’s picture

Im re-reading the module description now and think I see that this is by design. I had assumed that the less file would be compiled when changed and included as drupal css.

Is it by design that it only export a compiled file, and that I then should copy this into the theme directory? Is there a simple way to handle this during development? I can symlink the results into the theme dir, but it seems that the inclusion of the .less file in the final output could cause browser issues.

TimeRaider’s picture

I think the issue lies in less.module line #11
$base_path = $_SERVER['DOCUMENT_ROOT'] . base_path();

Addition:
The way GoDaddy works is it sets the right path to addtional sites in $_SERVER['SUBDOMAIN_DOCUMENT_ROOT'] instead of $_SERVER['DOCUMENT_ROOT'], so i've changed line #11 respectively and it worked.

corey.aufang’s picture

StatusFileSize
new1.28 KB

Thank you for bringing this to my attention.

I think I may have a solution that will remove the dependency on $_SERVER['DOCUMENT_ROOT'].

Try this patch:

andb’s picture

Wonderful. Works as intended. Patch applied cleanly and the LESSified CSS is properly loading now. Thank you for such rapid support!

Leaving ticket open in case TimeRaider has any issues.

TimeRaider’s picture

Worked perfect for me! Thanks a lot!

PS: Please, set an appropriate status for this Issue for I'm not sure what it needs to be. It's my first time :)

andb’s picture

Status: Active » Closed (fixed)
corey.aufang’s picture

Status: Closed (fixed) » Active

Please don't change the status of issues to "fixed" or any of the "postponed" or "closed" statuses.

I need to use the status for tracking my work on this module, and once I complete my work for an issue, I'll change the status to "fixed".

corey.aufang’s picture

Status: Active » Fixed

This is now being pushed in a new version.

Status: Fixed » Closed (fixed)

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