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.
Is there a reason to get the original css in advagg_processor from $variables['css'] instead of drupal_add_css()?
I have a problem with this in combination with the Omega theme. The preprocess_page function of this theme adds css files with drupal_add_css and puts those in the page with $vars['styles'] = drupal_get_css(); In that way, these css files are not present in $variables['css']. You can say that this is a problem of Omega, but a lot of themes do it like that.
So could you give some more insight in using $variables['css'] or can we just change this?
Comment | File | Size | Author |
---|---|---|---|
#6 | advagg-merge-1077136-6.patch | 4.83 KB | mikeytown2 |
#3 | advagg-better-css-debug-1077136-3.patch | 1.11 KB | mikeytown2 |
Comments
Comment #1
pgrond CreditAttribution: pgrond commentedComment #2
pgrond CreditAttribution: pgrond commentedHmm, maybe it is not a good idea. Using drupal_add_css doesn't play well with dcss.
Will try to fix this in the theme layer.
Comment #3
mikeytown2 CreditAttribution: mikeytown2 commentedWaiting to hear back what you think is the best way to handle this. BundleCache uses $variables['css']; I figured that module has been out longer and thus battle tested, so I copied that design.
this patch has been committed.
Comment #4
pgrond CreditAttribution: pgrond commentedHi,
I think it is enough to do a array_merge of $variables['css'] and drupal_add_css().
Now I think of it, I think it is an error if a theme changes the css and not update the $variables['css'], but I think more themes do that. So, if they use drupal_add_css and $variables['styles'] = drupal_get_css() to change the files, an array_merge will catch this.
Comment #5
mikeytown2 CreditAttribution: mikeytown2 commentedComment #6
mikeytown2 CreditAttribution: mikeytown2 commentedcommitted this patch. Merges the 2 array together.