Weasyprint: Add support for CSS Custom Properties

Created on 6 Dec 2017  路  5Comments  路  Source: Kozea/WeasyPrint

This would allow CSS authors to define shared variables ("custom properties") and reference them using the var() function.

See the CSS Custom Properties for Cascading Variables Module Level 1 spec.

feature

Most helpful comment

I've open a variables branch supporting variables. Current work only works with very simple cases, but more will come (including tests of course).

All 5 comments

Are there any updates on this ticket? What would be needed to build this feature?

In my eyes, this feature would be critical for more dynamic documents. Personally, I would use it to add user-specified variables (e.g. colours) in the template files in a :root {} declaration, and have static CSS files using these variables. This would avoid a lot of CSS overwriting in .html template files.

Syntax is now supported by tinycss2.

Will the version of tinycss2 required here be bumped?

Will the version of tinycss2 required here be bumped?

Yes, but having the syntax support is not enough. I have to add some code in WeasyPrint too!

I've open a variables branch supporting variables. Current work only works with very simple cases, but more will come (including tests of course).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

elyak123 picture elyak123  路  3Comments

thejasechen picture thejasechen  路  3Comments

amarnav picture amarnav  路  5Comments

bjornasm picture bjornasm  路  3Comments

Daniyal-Javani picture Daniyal-Javani  路  3Comments