Skip to content

Arbitrary CSS variable with variant prefix #11241

Closed
@zipper

Description

@zipper

What version of Tailwind CSS are you using?
3.3.2

What build tool (or framework if it abstracts the build tool) are you using?
Not sure, simulated on Tailwind Play though.

What version of Node.js are you using?
See above.

What browser are you using?
Doesn't matter.

What operating system are you using?
Doesn't matter.

Reproduction URL
https://play.tailwindcss.com/uGZbOX6jll

Describe your issue
When using arbitrary CSS variables as seen in docs https://tailwindcss.com/docs/adding-custom-styles#arbitrary-properties, there is an issue when:

  • Variant prefix for media is used (may be a problem with other variants as well, not sure)
  • and theme function is used using [] to retrieve value.

E.g. these classes does work properly
✔️ [--bar:theme('spacing[1.5]')] - even though [] is used, it still works because there is no variant.
✔️ md:[--foo:theme('spacing.2')] - variant is used, but dot notation for value.

But this one doesn't:
md:[--bar:theme('spacing[2.5]')] - [] and variant is used together, resulting in malformed CSS output.

All three classes are used in demo above, where first two works as intended, but the last one does not.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions