【问题标题】:Tailwindcss Background color not parsedTailwindcss 背景颜色未解析
【发布时间】:2022-02-04 04:59:56
【问题描述】:

使用 tailwindcss 并应用背景颜色不会被解析

这是我的顺风配置

const colors = require("tailwindcss/colors");
module.exports = {
  future: {
    removeDeprecatedGapUtilities: true,
    purgeLayersByDefault: true,
  },
  purge: ["./pages/**/*.{js,ts,jsx,tsx}", "./components/**/*.{js,ts,jsx,tsx}"],
  darkMode: false, // or 'media' or 'class'
  theme: {
    colors: {
      "saibaba-orange": {
        light: "#ff6426",
        DEFAULT: "#ff6426",
        dark: "#ff6426",
      },
    },

    minHeight: {
      0: "0",
      "1/4": "25%",
      "1/2": "50%",
      "3/4": "75%",
      full: "100%",
    },
    extend: {
      fontFamily: {
        sans: ["Lora", "Helvetica", "Arial", "sans-serif"],
      },
      backgroundImage: {
        "hero-pattern":
          "url('/img/banner_bg.png')",
      },
    },
  },
  variants: {
    extend: {
      backgroundColor: [
        "responsive",
        "hover",
        "focus",
        "active",
        "group-hover",
      ],
    },
  },
  corePlugins: {},
  plugins: [require("tailwindcss"), require("precss"), require("autoprefixer")],
};

例如在 html 中使用背景类将不会产生任何输出。检查 DOM 没有对 CSS 类的引用。

<div class="bg-blue-500"></div>

【问题讨论】:

标签: css styles tailwind-css


【解决方案1】:

您正在覆盖 theme.colors 中的默认颜色。您需要将自定义颜色移动到扩展中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-06-17
    • 2022-01-05
    • 2013-12-25
    • 1970-01-01
    • 2021-07-21
    • 2019-02-08
    • 1970-01-01
    • 2023-02-16
    相关资源
    最近更新 更多