Skip to main content

注意规范

class 使用完整类名

Tailwind 扫描源代码 classes是通过正则表达式匹配可能是类名的字符串。这种方式可以在任何类型语言文件中生效。 所以动态类名需要注意的是: 不要<div class="text-{{ error ? 'red' : 'green' }}-600"></div>这种使用方式,识别不到。

使用第三方ui或者组件库项目中写自己的css时,不推荐使用@layer

@tailwind base;
@tailwind components;

.select2-dropdown {
@apply rounded-b-lg shadow-md;
}
.select2-search {
@apply border border-gray-300 rounded;
}
.select2-results__group {
@apply text-lg font-bold text-gray-900;
}
/* ... */

@tailwind utilities;