Skip to content

feat: resolve css variables#2

Closed
paviad wants to merge 3 commits into
itext:developfrom
paviad:pr-css-variables
Closed

feat: resolve css variables#2
paviad wants to merge 3 commits into
itext:developfrom
paviad:pr-css-variables

Conversation

@paviad

@paviad paviad commented Dec 14, 2024

Copy link
Copy Markdown

Current style sheet logic ignores CSS variables, and can break when parsing them.

This PR properly resolves CSS variables.

@denighte

denighte commented Mar 27, 2025

Copy link
Copy Markdown

Hi @paviad, thank you very much for your idea and contribution, but unfortuantely we had to fix it differently than you did, since your code does not take into account a lot of cases. Also we decided to not use regex because of performance concerns. Here is some of the missed cases:

  1. Shorthands resolving
  2. Several var() expression in one css statement e.g. 1px var(--style) var(--color)
  3. Complex defaults handling and neted vars, e.g. var(--test, var(--another, 'black'))
  4. Cyclic references, e.g. --one: var(--two); --two: var(--one)
  5. Validation handling, e.g. word-break: var(--incorrect) should log a message that css declaration can't be resolved
    And other more minor stuff
    You can see all the changes in the following commit: 75380e906f718e34613ff3d63da44ce0738cde7e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants