我有 laravel 應用程式,我在其中使用了順風。但是當我寫一個順風類時,比如說,w-100它回傳:
[vite:css] [postcss] C:\Users\eymen\OneDrive\Desktop\work\websites\elnaj7\resources\css\app.css:4:1:
w-100該類不存在。如果w-100是自定義類,請確保它在@layer指令中定義。檔案:C:\Users\eymen\OneDrive\Desktop\work\websites\elnaj7\resources\css\app.css:4:1 構建期間出錯:CssSyntaxError: [postcss] C:\Users\eymen\OneDrive\Desktop\ work\websites\elnaj7\resources\css\app.css:4:1:w-100該類不存在。如果w-100是自定義類,請確保它在@layer指示。在 Input.error (C:\Users\eymen\OneDrive\Desktop\work\websites\elnaj7\node_modules\postcss\lib\input.js:148:16) atRule.error (C:\Users\eymen\OneDrive\ Desktop\work\websites\elnaj7\node_modules\postcss\lib\node.js:60:32) 在 processApply (C:\Users\eymen\OneDrive\Desktop\work\websites\elnaj7\node_modules\tailwindcss\lib\lib\ expandApplyAtRules.js:357:29) 在 C:\Users\eymen\OneDrive\Desktop\work\websites\elnaj7\node_modules\tailwindcss\lib\lib\expandApplyAtRules.js:505:9 在 C:\Users\eymen\OneDrive \Desktop\work\websites\elnaj7\node_modules\tailwindcss\lib\processTailwindFeatures.js:55:50 在插件(C:\Users\eymen\OneDrive\Desktop\work\websites\elnaj7\node_modules\tailwindcss\lib\index. js:38:63) 在 LazyResult.runOnRoot (C:\Users\eymen\OneDrive\Desktop\work\websites\elnaj7\node_modules\postcss\lib\lazy-result.js:339:16) 在 LazyResult。
我使用兩個輸入檔案,應用程式和用戶。
布局(縮短):
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta name="csrf-token" content="{{ csrf_token() }}">
<link rel="dns-prefetch" href="//fonts.gstatic.com">
@vite(['resources/css/app.css'])
<link rel="stylesheet" href="{{ asset('css/app.css') }}"> <!--when I remove this line all tailwind basic stylings get removed-->
<!-- styles -->
@yield('styles')
<!-- Head Scripts -->
@yield('head-scripts')
</head>
<body>
<div id="app">
@yield('content')
</div>
</body>
</html>
vite.config:
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
plugins: [
laravel({
input: [
'resources/css/app.css',
'resources/css/user.css',
],
refresh: true,
}),
],
});
尾風配置
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./resources/views/auth/**/*.blade.php',
'./resources/views/errors/**/*.blade.php',
'./resources/views/layouts/**/*.blade.php',
'./resources/views/user/**/*.blade.php',
'./storage/framework/views/*.php',
],
theme: {
},
plugins: [],
}
輸出檔案有一些生成的類,因為我試圖在沒有 vite 的情況下運行 tailwind。但是發生了很多問題,我回到了vite。
uj5u.com熱心網友回復:
w-100不是默認的 Tailwind 類,你擁有的最大的是w-96. 這就是為什么它告訴您將其作為自定義類添加到配置中。
這是 Tailwind 關于寬度的檔案:https ://tailwindcss.com/docs/width
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/525591.html
標籤:拉拉维尔顺风CSS维特
