Skip to content

CSS style not loading when printing. #205

Answered by ElMassimo
rachitpant asked this question in Q&A
Discussion options

You must be logged in to vote

By default, Rails uses media: 'screen' when rendering stylesheets, so Vite Ruby applies the same default for styles injected from a script.

Make sure to use media: 'all' when injecting the scripts or stylesheets if you want to apply those styles for print as well.

vite_javascript_tag 'application', media: 'all'
vite_stylesheet_tag 'styles.scss', media: 'all'

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by ElMassimo
Comment options

You must be logged in to vote
1 reply
@ElMassimo
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants