Nandra Mihnea
Nandra Mihnea

Reputation: 31

theme() from Tailwind is not recognized

I know it may be a silly question but I cannot find the answer anywhere. I'm using Tailwind with CRA and CSS modules.

I've overwritten the default theme colors to my own ones. When I try to use the colors inside my CSS modules like this,

.amountSign {
    color: theme('colors.pink');
}

it seems like theme() is not recognized and in the browser the property value seems to be invalid.

enter image description here

Should I import something from somewhere to make theme() recognizable? Thanks in advance

Upvotes: 2

Views: 4447

Answers (1)

Matt
Matt

Reputation: 940

Tailwind's functions and directives only work if your CSS is proccessed by Tailwind.

From what you've shared it looks like your CSS modules aren't ran through Tailwind and so Tailwind's theme() function is never compiled down to pure CSS.

This blog outlines the steps for using Tailwind with CRA.

Upvotes: 2

Related Questions