【问题标题】:layer components is not working in global.css in talwind css层组件在顺风 css 中的 global.css 中不起作用
【发布时间】:2022-06-10 18:08:43
【问题描述】:

I get following error for @layer components on global.css in tailwind.css 我在尝试导入顺风基础、组件和实用程序时遇到了同样的错误,我使用它解决了它 @import 和波浪号 ~。喜欢以下。猜猜这可以用同样的方法解决,但不知道怎么写@layer components

@import "~tailwindcss/base";
@import "~tailwindcss/components";
@import "~tailwindcss/utilities";

@layer components {
  .link {
    @apply cursor-pointer;
  }
}

【问题讨论】:

  • 请显示您的项目文件夹和文件结构 ;-) 并告诉我们您是如何安装 tailwindcss 的?
  • 我使用了 npm install tailwindcss
  • 你可以在我的github repogithub.com/imangi/amazon-clone看到我的文件结构@

标签: reactjs next.js tailwind-css


【解决方案1】:

As the documentation states,你应该写:

@tailwind base;
@tailwind components;
@tailwind utilities;

如果这不适合您,请分享您的 tailwind 配置文件配置,我们会尽力为您提供帮助 :)

【讨论】:

  • module.exports = { mode: "jit", purge: [ "./src/pages/**/*.{js,ts,jsx,tsx}", "./src/ components/**/*.{js,ts,jsx,tsx}", ], darkMode: false, theme: { extend: { colors: { amazon_blue: { light: "#232F3E", DEFAULT: "#131921", }, }, }, },变体:{ 扩展:{},},插件:[require("@tailwindcss/line-clamp")],};
  • 以上是我的顺风配置
  • 您是否完全按照文档进行操作?
  • 是的。我关注了
猜你喜欢
  • 2021-08-15
  • 2021-10-20
  • 2021-12-26
  • 1970-01-01
  • 2021-11-18
  • 2021-08-06
  • 1970-01-01
  • 2020-08-23
  • 2021-07-21
相关资源
最近更新 更多