This should maybe be a documentation request, or a bug report, not sure how to categorize it because I don't know if it is working as designed and I just missed something in a README file.

LESS won't process and render properly unless the theme is set to: "Peace! the css isnt touched, just as Drupal wants it to be ..."

CommentFileSizeAuthor
#1 fix-css-alter-hook-1136678-1.patch882 bytesrwohleb

Comments

rwohleb’s picture

Title: LESS requires 'Peace' setting » Mothership wipes out changes from other instances of hook_css_alter()
Status: Active » Needs review
StatusFileSize
new882 bytes

The issue here is that drupal_add_css() is being used inside hook_css_alter(). This hook gets an array of CSS files that could have already been sent through this hook in other modules. In this case it's LESS. By using drupal_add_css() and having no way to pass the CSS array, it ends up getting reset to what it's in the static cache handled by the drupal_static() function. I've updated the issue title to reflect this.

I see two options. We can either stop using drupal_add_css() inside this hook, or we temporarily change the static cache while we are in this hook. I'm attaching a patch that does the latter. While I don't like the idea of messing with the static cache like this, it's better than doing something like making a virtual copy of the drupal_add_css() function for our own use.

rwohleb’s picture

Category: support » bug

Setting this to 'bug report'.

mortendk’s picture

Assigned: Unassigned » mortendk
Status: Needs review » Needs work

can you test it with the latest copy the css file removal code has been rewritten.

btw why dont you use a precompiler like less app / codekit etc ?

mortendk’s picture

Status: Needs work » Closed (won't fix)