Allow print variant to work in conjunction with print "screen" #19280
DesignByOnyx
started this conversation in
Ideas
Replies: 1 comment
-
|
General pointers:
To get both class and media query versions, you can expand your @custom-variant print {
&:is(.print *) {
@slot;
}
@media print {
@slot;
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I started working on adding print styles and it went smooth as could be. Everything works as expected with the browser print behavior.
I then wanted to implement
html2pdf.jsto allow quick downloading of PDFs. In order to make this work, I added aprintvariant to kind of automatically pick up anyprint:*styles in my app. This too just worked! I could easily test it by adding the "print" class to the document.Then I tried using the native browser print behavior, and it no longer worked. It appears that the custom variant disables the "screens" config (for lack of better description). Removing the custom variant made the native browser print behavior work again.
I renamed the variant to "pdf", and this works, but it just requires that I duplicate all
print:*classes withpdf:*. Not a big deal, but it would be super cool if the variant could co-exist with the screens config.Beta Was this translation helpful? Give feedback.
All reactions