使用 laravel-mix 和 sass 以 JIT 模式升级到 Tailwindcss 2.1 后,未导入顺风模块

After upgrading to Tailwindcss 2.1 with JIT mode using laravel-mix and sass, tailwind modules are not being imported

我已经升级到 TailwindCss 2.1 并添加了模式:'jit' 到 tailwind.config.js。 当我运行yarn run dev时,只有tailwindcss/base被导入编译后的app.css文件

tailwind.css:

@import "tailwindcss/base";
/* end base */
@import "tailwindcss/components";
/* end comps */
@import "tailwindcss/utilities";
/* end utils */

app.scss:

 @import "../css/tailwind.css";
 /* start of custom css */

webpack.mix.js:

const mix = require('laravel-mix');
 const tailwindcss = require('tailwindcss');
 
 mix.sass('resources/scss/app.scss', 'public/css')
.options({
    processCssUrls: false,
    postCss: [
        tailwindcss('tailwind.config.js')
    ]
});

我最初是在 app.scss 文件中导入的,但移动了它们以查看是否有帮助。任何人都知道为什么“tailwindcss/components”和“tailwindcss/utilities”不会导入? “tailwindcss/base”导入以及在 app.scss

中导入的其他 scss 文件

谢谢。

事实证明 tailwind.config.js 的清除部分中的路径不正确:

  • 原文:
    purge: [
        './../resources/views/**/*.blade.php',
        './../vendor/livewire/livewire/src/**/*.blade.php',
        './public/**/*.html',
        './src/**/*.{js,jsx,ts,tsx,vue}',
    ],
  • 正确:
    purge: [
        './resources/views/**/*.blade.php',
        './vendor/livewire/livewire/src/**/*.blade.php',
        './public/**/*.html',
        './src/**/*.{js,jsx,ts,tsx,vue}',
    ],