-
-
Notifications
You must be signed in to change notification settings - Fork 790
Closed as not planned
Description
We are generating invoice PDFs using WeasyPrint 68.1.
The PDF renders successfully (no runtime errors), but layout and styling differ significantly from browser rendering when using CSS compiled from Tailwind CSS v4.1.18.
Tailwind v4 output includes modern CSS such as:
@layer theme {
:root {
--spacing: .25rem;
--color-stone-800: oklch(26.8% .007 34.298);
}
}
@layer utilities {
.size-3 {
width: calc(var(--spacing) * 3);
height: calc(var(--spacing) * 3);
}
.fill-stone-800 {
fill: var(--color-stone-800);
}
}When rendered with WeasyPrint 68.1, we see warnings such as:
Invalid or unsupported selector ':root,:host'Unknown rule @supportsIgnored padding-inline-startInvalid media type '(min-width:40rem)'Invalid media type '(prefers-color-scheme:dark)'Ignored fill:var(--color-stone-800)
As a result:
- Logical properties (
margin-inline, etc.) are ignored - Modern media queries are ignored
@supportsrules are ignoredoklch()colors may not apply- Some CSS variables used inside
calc()do not behave as in browsers
The PDF renders, but styling is incomplete or incorrect compared to browser output.
Environment
- WeasyPrint: 68.1
- Python: 3.12.3
- OS: Linux (WSL2)
- Tailwind CSS: 4.1.18
Question
Does WeasyPrint 68.1 officially support:
@layer- CSS custom properties (
var()) - Logical properties (
margin-inline, etc.) oklch()color functions- Modern media queries (
min-width,prefers-color-scheme) @supportsat-rules
If not, is preprocessing required before rendering CSS from modern frameworks like Tailwind v4?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels