我通过我的CSS文件设置了它,并试图为headers h1、h2、.但是我喜欢把逻辑分开一点,这样就不会太乱了,所以我试着‘@import './typography.css’--其中包括一些顺风,但它不起作用。
下面是我的基本CSS文件:
@tailwind base;
@tailwind components;
@tailwind utilities;
@tailwind variants;
@import './typography.css';我的排版:
h1 {
@apply text-6xl font-normal leading-normal mt-0 mb-2;
}
...我有什么办法让这件事起作用吗?
更新
我试过:
@layer base文件中添加了typography.css,但是收到了一个错误:Syntax error: /typography.css "@layer base" is used but no matching @tailwind base@layer base { @import("typography.css") } )执行此操作,这不会造成错误,但不会应用样式。发布于 2021-10-28 08:42:34
您需要设置目标层才能工作。由于要更改typography.css文件中的基本html元素,请执行以下操作:
@layer base {
h1 {
@apply text-6xl font-normal leading-normal mt-0 mb-2;
}
}这里的文档中有更多的细节:https://tailwindcss.com/docs/adding-base-styles
发布于 2022-06-14 11:43:19
您必须使用postcss-import
https://tailwindcss.com/docs/adding-custom-styles#using-multiple-css-files
https://tailwindcss.com/docs/using-with-preprocessors#build-time-imports
如果你使用拉拉维尔webpack混合,加入它在.postCss(....)中
.postCss('resources/css/app.css', 'public/css', [
require('postcss-import'), // <------------ add postcss-import here
require('tailwindcss'),
])发布于 2022-06-20 08:27:58
postcss.config.js文件
module.exports ={ plugins:{‘postcss’:{},tailwindcss:{},}@tailwind base;添加到typography.css的顶部有关更多的数据,您可以查看以下链接:https://tailwindcss.com/docs/using-with-preprocessors#build-time-imports
https://stackoverflow.com/questions/69746121
复制相似问题