【问题标题】:No border-orange-400 class in tailwind css (vue 3)顺风css(vue 3)中没有border-orange-400类
【发布时间】:2022-01-21 22:05:26
【问题描述】:

只是在 vue 3 应用程序中弄乱了 tailwind css...看起来没有border-orange-400 实用程序类:

.notification-warning {
   @apply border-orange-400 text-sm font-bold;
}

控制台输出:

Syntax Error: SyntaxError
(15:12) The `border-orange-400` class does not exist, but `border-green-400` does. If you're 
sure that `border-orange-400` exists, make sure that any `@import` statements are being 
properly processed before Tailwind CSS sees your CSS, as `@apply` can only be used for classes 
in the same CSS tree.

我的 package.json sn-p:

 "autoprefixer": "^9.8.8",
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-vue": "^7.0.0",
"postcss": "^7.0.39",
"prettier": "^2.2.1",
"tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.17",
"typescript": "~4.1.5",
"vue-jest": "^5.0.0-0"

【问题讨论】:

    标签: css typescript vue.js vuejs3 tailwind-css


    【解决方案1】:

    默认不启用橙色,但您可以添加如下:

    tailwind.config.js

    const colors = require("tailwindcss/colors");
    
    module.exports = {
    
        purge: ['./src/**/*.html', './src/**/*.vue', './src/**/*.js', './src/**/*.ts', './src/**/*.tsx', './src/**/*.css'],
    
        darkMode: 'class', // or 'media' or 'class'
        theme: {
            extend: {
                colors: {
                    orange:colors.orange,
                
                },
        
            },
        },
    
    };
    
    

    【讨论】:

    • 不工作:语法错误:ReferenceError:颜色未在新承诺()中定义
    • 你添加const colors = require("tailwindcss/colors");了吗?
    • 我有课外
    • @momi 请分享您的tailwind.config.js 文件
    • module.exports = { purge: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'], content: [], theme: { extend: {}, }, variants: { extend: { fontWeight: ['hover'], backgroundColor: ['disabled'], border: ['focus'], } }, plugins: [], }
    猜你喜欢
    • 2021-04-17
    • 2022-08-03
    • 2022-07-18
    • 1970-01-01
    • 2019-03-02
    • 1970-01-01
    • 1970-01-01
    • 2011-03-08
    • 2022-01-18
    相关资源
    最近更新 更多