Skip to content

Conversation

@philipp-spiess
Copy link
Member

Fixes #15632
Fixes #15740

This PR fixes a number of Oxide scanner bugs reported over various channels, specifically:

  • When using the Svelte class shorthand split over various lines, we weren't extracting class names properly:

    <div
      class:underline={isUnderline}>
    </div>
  • We now extract classes when using the class shortcut in Angular:

    <div [class.underline]=\"bool\"></div>
  • We now validate parentheses within arbitrary candidates so that we don't consume invalid arbitrary candidates anymore which allows us to parse the following case properly:

    const classes = [wrapper("bg-red-500")]

Test plan

Added unit tests

@philipp-spiess philipp-spiess requested a review from a team as a code owner January 28, 2025 15:16
@RobinMalfait RobinMalfait enabled auto-merge (squash) January 28, 2025 16:18
@RobinMalfait RobinMalfait merged commit b492187 into next Jan 28, 2025
5 checks passed
@RobinMalfait RobinMalfait deleted the fix/oxide-parser branch January 28, 2025 16:19
@paolominel
Copy link

in version 4.0.1 the bug is still present (almost for angular shorthand syntax)

@philipp-spiess
Copy link
Member Author

@paolominel What's the exact file you've used that doesn't work?

@paolominel
Copy link

I use tailwind classes in angular host component.
i tried something like:

..., host: { "[class.underline]": "active()" }

active variable was a signal inside the relative angular component.

this class was not fired and not compiled during tailwind class scanning.
if i use not optional syntax ("class": "underline"), everything works well.

@paolominel
Copy link

still present in version 4.0.3. tried this morning after library upgrade

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.

[v4] Angular conditional class not recognized by tailwind [v4] Class Detection Bug

5 participants