【发布时间】:2021-01-23 12:17:19
【问题描述】:
我在我的项目中使用 Tailwind,并且我想创建使用 Tailwind 现有类的类。例如,我的按钮当前如下所示:
<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>
如您所见,我使用了很多类,而我希望使用类似这样的东西:
<button class="app-btn"> Button </button>
与
@import '/node_modules/tailwindcss/utilities.css';
.app-btn {
@extend .text-light-blue;
@extend .bg-white;
...
}
但是当我尝试这样做时,出现以下错误:
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
有没有办法实现我想要做的事情? 谢谢
【问题讨论】:
标签: css sass tailwind-css