Reputation: 34576
I'm playing around in Tailwind and this video suggests that you can avoid the repetition of Tailwind classes by using Sass like so:
HTML
<button class=but>Button</button>
SASS
.but {
@apply bg-green-400 p-5 rounded-lg m-5 text-white
}
...but this isn't working for me; the styles don't get rendered and Codepen's CSS editor complains about a new line being expected. Here's my pen - it has Tailwind and Sass active.
What am I doing wrong?
Upvotes: 0
Views: 850
Reputation: 14293
You're using CDN Tailwind which cannot support a lot of features @apply
included - it simply cannot generate your class on the fly
Documentation says
Before using the CDN build, please note that many of the features that make Tailwind CSS great are not available without incorporating Tailwind into your build process.
@apply
, @variants
, etc.group-focus
Upvotes: 1