vinicius-bortoletto
vinicius-bortoletto

Reputation: 319

How do I get @apply to work in TailwindCSS?

I can't seem to get TailwindCSS @apply to work. Visual Studio Code doesn't seem to recognise my code.

enter image description here

.btn {
  @apply mb-2 bg-purple-600 text-gray-100 font-bold p-3 rounded;
}

Upvotes: 2

Views: 1373

Answers (2)

Ben
Ben

Reputation: 2235

Write it all in one line:

.btn {
  @apply mb-2 bg-purple-600 text-gray-100 font-bold p-3 rounded;
}

I hope it helps.

Upvotes: 1

Onur Sabanoglu
Onur Sabanoglu

Reputation: 44

No tailwind class names you defined in the apply command '.' you don't need to put it.

As a solution, write all tailwind elements in one line.

.btn {
  @apply mb-2 bg-purple-600 text-gray-100 font-bold p-3 rounded;
}

Upvotes: 2

Related Questions