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.
I have the following css:
.inner-wrap, .page-body {
max-width: 80em;
padding: 0 0.8em;
margin: 0 auto;
position: relative;
}
.page-body {
padding-top: 2.4em;
padding-bottom: 2.4em;
}
In that order. When I turn on advagg with default settings, suddenly the compressed css has the .inner-wrap selector after and therefore overriding my padding-top and bottom.
Comments
Comment #2
mikeytown2 CreditAttribution: mikeytown2 commentedNeed more info to reproduce this reported issue
.inner-wrap,.page-body{max-width:80em;padding:0 0.8em;margin:0 auto;position:relative;}.page-body{padding-top:2.4em;padding-bottom:2.4em;}
Comment #3
aeotrinI'll see if I can record the steps to reproduce. This just started happening on the last version update. I will test but I have a feeling it might have to do with the IE selector limit or any optimizers that might be running.
Comment #4
mikeytown2 CreditAttribution: mikeytown2 commentedSpliting up CSS was rewritten due to this issue #2852487: advagg_split_css_file() can lead to infinite loop; issue with large css files. (over 5k selectors for a single set of rules).
Comment #5
aeotrinThanks, Ill debug it and see if I can find out what might be causing it.
For reference my compiled css file is approximately 16K lines and the 2 selectors that I am finding out of order appear in the middle and the end of this file. Ill let you know what I find.
Comment #6
aeotrinFound the bug. The grouping smaller chunks together was adding the first chunk to the end of the second chunk if the selector count was within the limit. It should have been changing the second chunk to be equal to the first chunk + second chunk.
See patch.
Comment #7
mikeytown2 CreditAttribution: mikeytown2 commentedComment #8
mikeytown2 CreditAttribution: mikeytown2 commentedI'll work on this tomorrow. Only concern is if multiple CSS parts get combined (think media queries). I'll want to test it.
Comment #9
aeotrinSounds good. My only concern that the patch solves is this:
It should not be appending the previous value to the end of the next value. It should be prepending the previous value to the next value.
Comment #10
mikeytown2 CreditAttribution: mikeytown2 commentedComment #11
mikeytown2 CreditAttribution: mikeytown2 commentedVerified and this works. Found a flaw in advagg_split_css_string where it's dropping the last selector in large rule sets (over the 4k limit). Will work on a solution and hopefully create a test; the test css file will have to be generated as I'm using a 5mb css file for testing currently.
Comment #13
mikeytown2 CreditAttribution: mikeytown2 commentedCode used to test
If the selector counts don't match then it messed up.
To check the order diff seems like the only way to do it... which I can do locally but not in an automated way.
Still need to generate a large css file for testing purposes.
Comment #15
mikeytown2 CreditAttribution: mikeytown2 commentedTests a generated file with 280,028 selectors making sure it gets split correctly.
Comment #17
mikeytown2 CreditAttribution: mikeytown2 commented