Skip to content
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

Fix incorrectly generated CSS when using square brackets inside arbitrary properties #11709

Merged
merged 2 commits into from
Jul 28, 2023

Conversation

RobinMalfait
Copy link
Contributor

@RobinMalfait RobinMalfait commented Jul 28, 2023

This PR fixes an issue where using square brackets inside arbitrary properties could result in incorrect CSS.

If you have the following class: md:[--bar:theme('spacing[2.5]')]
Then the output looked like this:

@media (min-width: 768px) {
  {
    --bar: 0.625rem;
  }
}

With this fix in place, the output looks like this:

@media (min-width: 768px) {
  .md\:\[--bar\:theme\(\'spacing\[2\.5\]\'\)\] {
    --bar: 0.625rem;
  }
}

Fixes: #11241

@RobinMalfait RobinMalfait changed the title Fix incorrect CSS when using nested square brackets inside arbitrary properties Fix incorrectly generated CSS when using nested square brackets inside arbitrary properties Jul 28, 2023
@RobinMalfait RobinMalfait changed the title Fix incorrectly generated CSS when using nested square brackets inside arbitrary properties Fix incorrectly generated CSS when using square brackets inside arbitrary properties Jul 28, 2023
@RobinMalfait RobinMalfait merged commit e4b398b into master Jul 28, 2023
10 checks passed
@RobinMalfait RobinMalfait deleted the fix/issue-11241 branch July 28, 2023 10:37
@ktmn
Copy link

ktmn commented Jul 29, 2023

Should it work at play.tailwindcss.com if I set the version to Insiders (b6b3f85)?

Currently I get Error: Invalid empty selector with these classes:

<div class="border p-[--var] [--var:1rem] md:[--var:8rem]">Works</div>
<div class="border p-[--var] [--var:theme(spacing[4])] md:[--var:theme(spacing[32])]">Doesn't</div>

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.

Arbitrary CSS variable with variant prefix
2 participants