Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Here's an excerpt from my theme's .info file:
stylesheets[all][] = css/basics.less
stylesheets[all][] = css/dropdown-blocks.less
stylesheets[all][] = css/main.less
conditional-stylesheets[if lte IE 7][all][] = css/ie7.less
All stylesheets specified with "stylesheets[]" are processed and linked as expected, but the conditional stylesheet is not -- IE7 loads the LESS source code.
Comments
Comment #1
adamdicarlo CreditAttribution: adamdicarlo commentedTook a quick look into this and realized the conditional-stylesheets feature is provided by Zen to Zen subthemes.
Adding support in the LESS module for those stylesheets would be wonderful but it would definitely take some work....
Comment #2
corey.aufang CreditAttribution: corey.aufang commentedconditional-stylesheets is handled by the theme or the conditional_styles module (which zen copies their functionality from) and directly generates the link tags on the page.
This might be able to be hijacked by setting the Drupal var used to pass around the conditional styles and setting it with the processed file paths.
As long as we can make LESS runs before the hook_preprocess_page in the conditional_styles module and zen, we can hijack the variable and replace it with the processes conditional sheets
This will take more research.
I'm also postponing this till version 3.x as it will require refactoring of the main build function.
Comment #3
rbosscher CreditAttribution: rbosscher commentedIs it possible in the 7.x-3.x version to have conditional style sheets and overwrite a variable?
so in main.less we have:
and in main-overwrite.less
and after overwriting the variable have the h2 element turn blue?
Comment #4
corey.aufang CreditAttribution: corey.aufang commentedNot as you have shown.
But you can use the variables hooks provided with the LESS module.
https://drupal.org/node/2139603 is a documentation page that lists the basic functionality.
There are two variable alter hooks which have documentation in the file less.api.php included with the module.
You can also modify variables that are added through the hooks or .info files on your theme's settings page.
Comment #5
corey.aufang CreditAttribution: corey.aufang commentedThere will not be a fix for this in the 6.x-x.x branches. Sorry.