从 v2 更新到 v3 Laravel 8 后缺少 Tailwind 类
Tailwind missing classes after update from v2 to v3 Laravel 8
我将 tailwind 从 v2 更新到 v3,现在缺少一些 类。我试图重新安装 tailwind 及其依赖项,但没有帮助。
是什么导致了这种奇怪的行为?
示例:
w-6/12
w-7/12 <- does not exist
w-8/12
w-9/12
w-10/12
w-11/12 <- does not exist
w-12/12 <- does not exist
以及来自网格、字体大小等的其他类
版本
tailwindcss: 3.0.15
tailwindcss/aspect-ratio: 0.4.0
tailwindcss/forms: 0.4.0
tailwindcss/line-clamp: 0.3.1
tailwindcss/typography: 0.5.0
tailwind.config.js
const defaultTheme = require("tailwindcss/defaultTheme");
module.exports = {
content: [
'./storage/framework/views/*.php',
'./vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php',
'./vendor/laravel/jetstream/**/*.blade.php',
'./resources/views/**/*.blade.php',
],
prefix: 'tw-',
theme: {
extend: {
fontFamily: {
sans: ['Nunito', ...defaultTheme.fontFamily.sans],
},
},
backgroundColor: theme => ({
...theme('colors'),
'header': '#ffffff',
'main': '#f2f2f3',
'content': '#ffffff'
}),
textColor: theme => ({
...theme('colors'),
'main': '#333333'
})
},
plugins: [require('@tailwindcss/forms'), require('@tailwindcss/typography')],
}
webpack.mix.js
const mix = require('laravel-mix');
mix.js('resources/js/app.js', 'public/js')
.postCss("resources/css/app.css", "public/css", [
require("tailwindcss")])
.sass('resources/sass/app.scss', 'public/css')
.sourceMaps();
resources/css/app.css
@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';
解决了这个伪问题。
问题是我不太了解将 purge
更改为 content
的新事物,现在我必须在更改样式时编译它们。另外,之前版本的phpstorm没有看到类,也因此没有给出提示。
我将 tailwind 从 v2 更新到 v3,现在缺少一些 类。我试图重新安装 tailwind 及其依赖项,但没有帮助。 是什么导致了这种奇怪的行为?
示例:
w-6/12
w-7/12 <- does not exist
w-8/12
w-9/12
w-10/12
w-11/12 <- does not exist
w-12/12 <- does not exist
以及来自网格、字体大小等的其他类
版本
tailwindcss: 3.0.15
tailwindcss/aspect-ratio: 0.4.0
tailwindcss/forms: 0.4.0
tailwindcss/line-clamp: 0.3.1
tailwindcss/typography: 0.5.0
tailwind.config.js
const defaultTheme = require("tailwindcss/defaultTheme");
module.exports = {
content: [
'./storage/framework/views/*.php',
'./vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php',
'./vendor/laravel/jetstream/**/*.blade.php',
'./resources/views/**/*.blade.php',
],
prefix: 'tw-',
theme: {
extend: {
fontFamily: {
sans: ['Nunito', ...defaultTheme.fontFamily.sans],
},
},
backgroundColor: theme => ({
...theme('colors'),
'header': '#ffffff',
'main': '#f2f2f3',
'content': '#ffffff'
}),
textColor: theme => ({
...theme('colors'),
'main': '#333333'
})
},
plugins: [require('@tailwindcss/forms'), require('@tailwindcss/typography')],
}
webpack.mix.js
const mix = require('laravel-mix');
mix.js('resources/js/app.js', 'public/js')
.postCss("resources/css/app.css", "public/css", [
require("tailwindcss")])
.sass('resources/sass/app.scss', 'public/css')
.sourceMaps();
resources/css/app.css
@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';
解决了这个伪问题。
问题是我不太了解将 purge
更改为 content
的新事物,现在我必须在更改样式时编译它们。另外,之前版本的phpstorm没有看到类,也因此没有给出提示。