Skip to content

Color swatches missing from mask-* utilities #1295

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
thecrypticace opened this issue Apr 2, 2025 · 0 comments
Open

Color swatches missing from mask-* utilities #1295

thecrypticace opened this issue Apr 2, 2025 · 0 comments

Comments

@thecrypticace
Copy link
Contributor

thecrypticace commented Apr 2, 2025

This is an intentional omission in IntelliSense at the moment. I noticed some perf problems related to what's required to calculate color swatches.

Some notes:

  • We compile all classes inside getClassList() up front to calculate color swatches
  • Compiling all 19k classes takes like 600ms+ plus additional overhead for parsing and computing the color swatches themselves
  • The 60% of that compile time is related to PostCSS
  • Making color computation lazy so it only happens when completions are requested increases the time it takes to 1.5s for v4.0.17 and ~3s for v4.1.
  • This happens even if the setup is identical (making color a getter + using lazy(…) to back it)
  • This basically means that calling the lazy getters inside the completion provider is 3–5x slower than if you called it after design system creation (this doesn't make sense and I have no idea why this happens)

In the short term I've set up some regex matches against class names to disable color swatch calculation which prevents classes from being compiled. All mask-* utilities are currently a part of this.

Ideas:

  • Remove postcss.parse from the compile(…) path
  • Add a candidatesToAst method to core so we can use the internal CSS ast representation directly
    • I don't really want to do this until we've shipped source maps in v4 though because the AST won't be externally stable until then
  • Duplicate the getColor() code such that it can operate on the Tailwind CSS core AST
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

No branches or pull requests

1 participant