Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Semicolons in CSS import statements break compressed CSS files #6337

Closed
robertgarrigos opened this issue Dec 18, 2023 · 5 comments · Fixed by backdrop/backdrop#4609
Closed

Comments

@robertgarrigos
Copy link

robertgarrigos commented Dec 18, 2023

Description of the bug

The compressed css is broken when the original style sheet contains an import rule with a ; within the url, like this:

@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;1,400;1,500&display=swap");

Steps To Reproduce

To reproduce the behavior:

  1. add that import rule to a css style sheet
  2. go to admin/config/development/performance and check on Aggregate and compress css files
  3. go to a page

Actual behavior

The site is broken because the compressed css file is broken

@argiepiano
Copy link

argiepiano commented Dec 24, 2023

@robertgarrigos thanks for reporting and providing a PR! I've been able to reproduce the problem. I also verified that the import url string is actually correct -- google fonts does provide urls with those semicolons in certain situations.

I also tested the fix, and that fixed the problem. While I'm no regex expert, I think the new expression is straightforward and correct. WFM.

Side note: when you provide PRs, don't forget to mark the issue as "has pull request", "needs testing" and "needs code review" - otherwise it's easy for people to overlook it.

@robertgarrigos
Copy link
Author

Thanks, @argiepiano. I cannot mark the issues. I might not have the permissions...

@argiepiano
Copy link

I cannot mark the issues. I might not have the permissions...

You may want to ask for access in Zulip.

@quicksketch
Copy link
Member

Looks like @robertgarrigos has been added to the triage group by someone and now has permissions to add labels. Thanks to whomever did that!

I pushed a commit to backdrop/backdrop#4609 to include test coverage in common.test to both ensure existing CSS is not broken by this change and imports like this will continue to work in the future. If tests all pass still this is ready to merge.

@quicksketch quicksketch changed the title broken compressed css file with an import rule with a ; in the url Semicolons in CSS import statements break compressed CSS files Jan 1, 2024
@quicksketch quicksketch added this to the 1.26.4 milestone Jan 1, 2024
@quicksketch
Copy link
Member

Thanks @robertgarrigos and @argiepiano! I have merged backdrop/backdrop#4609 into 1.x and 1.26.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants