我目前正在遵循laracasts的路径,我被困在试图覆盖默认的尾风颜色。

问题描述 投票:0回答:1

这是我的

tailwind.config.js

import defaultTheme from 'tailwindcss/defaultTheme';

/** @type {import('tailwindcss').Config} */
export default {
  content: [
    './resources/**/*.blade.php',
    './resources/**/*.js',
  ],
  theme: {
    extend: {
      fontFamily: {
        sans: ['Figtree', ...defaultTheme.fontFamily.sans],
      },
      colors: {
        black: "#060606",
      },
    },
  },
  plugins: [],
};

我的
app.css
文件是:

@import "tailwindcss";
@source "../views";

和我的Postcss配置文件(
postcss.config.js
):

export default {
  plugins: {
    "@tailwindcss/postcss": {},
    autoprefixer: {},
  },
};

如果有人知道为什么它不按预期工作,我将非常感谢您的帮助。
	
您使用尾风V3配置的混合物,但已安装了V4。修复:

unInstall the

autoprefixer
npm软件包。 Tailwind V4不再需要这,因为Tailwind在内部进行相同的工作。
unInstall the

@tailwind/postcss

laravel tailwind-css vite
1个回答
0
投票
npm软件包。您似乎正在使用Vite,因此您不需要Postcss集成路径。

删除

postcss.config.js
    。删除前面提到的两个软件包,这根本不需要。
  • 将自定义移民到您的输入CSS文件:
    tailwind.config.js
  • 删除
    @import "tailwindcss";
    @source "../views";
    /**
    * You may need to modify these paths to the real path relative
    * to this CSS file.
    */
    @source "../resources/**/*.blade.php";
    /**
    * You may not need the following directive if the JS files are
    * processed in Vite.
    */
    @source "../resources/**/*.js";
    
    @theme {
      --font-sans: Figtree, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
      /**
       * Not strictly needed as this is the default anyway.
       */
      --color-black: #000000;
    }
    
    文件。
        
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.