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

There is no way to use theme() with a arbitrary value or property containing a dot #6791

Closed
Serator opened this issue Dec 29, 2021 · 2 comments · Fixed by #6852
Closed

There is no way to use theme() with a arbitrary value or property containing a dot #6791

Serator opened this issue Dec 29, 2021 · 2 comments · Fixed by #6852

Comments

@Serator
Copy link

Serator commented Dec 29, 2021

What version of Tailwind CSS are you using?

For example: v3.0.8

What browser are you using?

Chrome 96.0.4664.110

What operating system are you using?

Windows 10

Reproduction URL

https://play.tailwindcss.com/FivB5hnvPh

Describe your issue

There is no way to use theme() with a arbitrary value or property containing a dot.

tailwind.config.js

module.exports = {
  theme: {
    spacing: {
      .5: 'calc(.5 * .25rem)',
      1: 'calc(1 * .25rem)',
    },
  },
}

Example code

<div class="w-[theme(spacing[0.5])]">Error</div>
<div class="w-[theme(spacing[1])]">Error</div>
<div class="w-[theme(spacing\[1\])]">Error</div>
<div class="w-[theme(spacing.1)]">Correct</div>
@Serator Serator changed the title There is no way to use theme() with a arbitrary value or property containing a dot. There is no way to use theme() with a arbitrary value or property containing a dot Dec 29, 2021
@RobinMalfait
Copy link
Member

Hey! Thank you for your bug report!
Much appreciated! 🙏

I've opened a PR to validate this behaviour and it looks like we already fixed it. This will be available in the next version (released later today) but you can already try it using the insiders build: npm install tailwindcss@insiders

@Redmega
Copy link

Redmega commented Jan 20, 2022

I'm facing this same issue trying to get calc() to work with theme() in an arbitrary value. According to the intellisense it's valid, but the css never actually gets generated/injected:

h-[calc(100%-theme('spacing.16'))]

https://play.tailwindcss.com/zsAHSyoNVo

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 a pull request may close this issue.

3 participants