We ran into a bug where @import CSS directives that contained protocol-relative paths would be somehow stripped before they made it into production's copy of the CSS. I tracked down the bug to a problem in the drupal_load_stylesheet_content regexp's exclusion of external content, and a patch to correct the problem is attached.
Comments
Comment #1
hlieberman CreditAttribution: hlieberman commentedMade an error with the previous patch. My fault!
Comment #2
hlieberman CreditAttribution: hlieberman commentedUploading the same (broken) patch is not helpful.
Comment #3
dawehnerAdding a tag.
Comment #4
hlieberman CreditAttribution: hlieberman commentedNew patch including unit test.
Comment #5
Wim Leers#352951: Make JS & CSS Preprocessing Pluggable broke this. Here's a reroll.
Comment #6
Wim Leers#5: css_dont_import_protocol_relative-2014851-5.patch queued for re-testing.
Comment #7
nod_looks ok to me.
Comment #8
alexpottI've apply the patch and reverted the change to core/lib/Drupal/Core/Asset/CssOptimizer.php and the tests fail. With they pass. Nice fix. In future it's nice to post a will fail patch that only contains the changes to the tests - so that we can confirm that we've fixed the issue and won't break it again.
Committed 4431c7e and pushed to 8.x. Thanks!
Comment #9
Wim LeersAlex: sorry, will do!
Comment #11
bradjones1Comment #12
bradjones1Here's a backport to D7. I don't believe this has a test in D7; can someone verify this?
Comment #13
mgiffordThere are no tests in @bradjones1's patch. Are they needed for this backport? If so we can at least tag it as "Needs tests".
What testing is required to get this into D7? The preg_replace_callback expression is the same as what got into D8, so that should be fine.
Comment #14
dcam CreditAttribution: dcam commentedSince I can't assign this to David_Rothstein I'm going to go ahead and set the status to RTBC so he'll see it.
The change in #12 to the regex string is the same as what went into D8, but as far as I can tell the D8 tests which were modified don't exist in D7. They're CSS optimization tests. I'm not sure if they're part of some other issue waiting to be backported. I couldn't find them if they are. Do we need to find some way to backport everything in the D8 patch? If not, then #12 is RTBC.
Comment #17
markhalliwellSorry, but this is a really major bug; one that cannot be fixed in contrib (AdvAgg still ultimately goes through core's aggregation if bundling/grouping is relatively simple enough). It's very common practice to add an
@import
statement for your theme's font, say from Google, at the top. I'm surprised I haven't noticed this before :-/ Regardless, here's the backported tests.Comment #18
helmo CreditAttribution: helmo at Initfour websolutions commentedWorks as expected!
Thanks.
Comment #21
dcam CreditAttribution: dcam commentedComment #22
Arlina CreditAttribution: Arlina commentedPatch from #17 (drupal_css-2014851-17.patch) works correctly against latest drupal 7.36.
Comment #23
David_Rothstein CreditAttribution: David_Rothstein commentedCommitted to 7.x - thanks!
Fixed on commit (this list is in theory supposed to be kept up to date, as was done in the committed Drupal 8 patch):
We also should keep the files in css_test_files/css_subfolder in sync with the main ones, but I'll file a separate followup for that (affects Drupal 8 too).
Comment #25
David_Rothstein CreditAttribution: David_Rothstein commentedComment #26
David_Rothstein CreditAttribution: David_Rothstein commentedAnd back to Drupal 6 for this issue (due to the backport tag), in case someone wants to work on it there.
Comment #27
mikeytown2 CreditAttribution: mikeytown2 commented@markcarver
Heads up that AdvAgg ended up copying and patching most of core's logic. As a result I keep an eye on issues like this one so that the 2 are in sync for the most part :)
#2035817: Back port some code fixes for CSS optimizations
Comment #28
Perseids CreditAttribution: Perseids commentedIsn't there another solution? because patching the core every time there is an update is...
Update: never mind didn't notice this was fixed in 7.37