I use Tailwind for my project and I would like to create classes which use tailwind existing classes. For example, my buttons currently look like this:
<button class="text-light-blue bg-white rounded-full border-solid border-2 border-light-blue py-1 px-4 box-border shadow hover:bg-blue-700 hover:text-white hover:border-blue-700">
Button
</button>
As you can see I use a lot of classes and I would like to have instead something like this:
<button class="app-btn"> Button </button>
with
@import '/node_modules/tailwindcss/utilities.css';
.app-btn {
@extend .text-light-blue;
@extend .bg-white;
...
}
but when I try to do this I have the following error:
SassError: ".app-btn" failed to @extend ".bg-white".
The selector ".bg-white" was not found.
Use "@extend .bg-white !optional" if the extend should be able to fail.
on line 4 of src/assets/styles/app-shared-style.scss
Is there a way to achieve what I'm trying to do? Thanks