Hey,

I was wondering if it is possible to add css after conditional styles?

Unfortunately the framework I work with expects that one css is added after all the other styles including conditional ones.

Is this possible?

I have tried every variation of drupal_add_css but the conditional styles always appear last.

Comments

raekjaer’s picture

The module sets weight to 999. So in your drupal_add_css you should probably set weight to a higher value.

sylus’s picture

The conditional stylesheets regardless of the weight to not affect the placement of those styles as not grouped in with regular stylesheets.

raekjaer’s picture

You can do something like this from your theme:

function mytheme_preprocess_html(&$vars) {
 
    //Add stylesheet after conditional stylesheets
    drupal_add_css(
           path_to_theme() . '/path/to/mystylesheet.css',
           array(
             'group' => CSS_THEME,  //Conditional styles has CSS_THEME, so we equal that weight
             'every_page' => TRUE,  //Conditional styles has TRUE, so we equal that weight
             'weight' => 9999, //Conditional styles module has 999, so it must be higher
             'preprocess' => FALSE //Disable CSS aggregation/compression for weights to take effect with conditionals
           )
         );

}

So actually conditional stylesheets are grouped with regular stylesheets. But because preprocessing has been disabled for conditionals, you have to do the same with your render-me-last stylesheet.

raekjaer’s picture

Issue summary: View changes

Log

astonvictor’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

I'm closing it because the issue was created a long time ago without any further steps.

if you still need it then raise a new one.
thanks