Split print styles to separate stylesheet#10419
Merged
Conversation
changelog: Internal, Performance, Reduce size of common application stylesheet
zachmargolis
approved these changes
Apr 12, 2024
| <%= preload_link_tag font_url('public-sans/PublicSans-Regular.woff2') %> | ||
| <%= render_stylesheet_once_tags %> | ||
| <%= stylesheet_link_tag 'application', media: 'all' %> | ||
| <%= stylesheet_link_tag 'application' %> |
Contributor
There was a problem hiding this comment.
does it make a difference to keep the media: 'all' or is that basically the default value?
Contributor
Author
There was a problem hiding this comment.
I think it's redundant. I couldn't find anything which explicitly states that it's the default, but this documents the distinction between print and screen, and all as matching the union. I assume we meant it as applying the same as if it weren't applied at all.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🛠 Summary of changes
Splits print styles to separate stylesheet, so that it's only loaded when printing.
Why?
Performance Impact:
Before: 18.4 kB
After: 18.3 kB
Diff: -0.1 kB (-0.5%)
📜 Testing Plan
Verify that print styles are preserved:
Verify that the print stylesheet is not preloaded:
curl -I --silent http://localhost:3000 | grep 'link:'print.css