简体   繁体   English

Tailwindcss 背景颜色未解析

[英]Tailwindcss Background color not parsed

using tailwindcss and applying background colors does not getting parsed使用 tailwindcss 并应用背景 colors 没有被解析

here is my tailwind config这是我的顺风配置

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")],
};

using in html for example the background class will not produce any output.例如,在 html 中使用背景 class 将不会产生任何 output。 Inspecting the DOM there is no reference to the CSS class.检查 DOM 没有提到 CSS class。

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

You are overriding the default colors within your theme.colors.您正在覆盖您的 theme.colors 中的默认 colors。 You need to move your custom colors into extend.您需要将自定义 colors 移动到扩展中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM