med*_*ies 2 windows laravel tailwind-css vite laravel-9
我正在进行一个新Laravel9的Vite3项目TailwindCss3。
仅使用npm run build不足以部署应用程序!
当我不运行 Vite 的开发服务器时,出现以下错误:
无法在 Vite 清单中找到文件:resources/css/app.css。
但当我使用时npm run dev一切正常!
我使用了以下命令:
laravel new vite-test --git &&
cd .\vite-test\ &&
npm i &&
npm install -D tailwindcss postcss autoprefixer &&
npx tailwindcss init -p &&
php ./artisan serve
Run Code Online (Sandbox Code Playgroud)
并按照文档编辑了以下文件:
<!-- resources\views\welcome.blade.php -->
<!DOCTYPE html>
<html lang="en">
<head>
@vite(['resources/css/app.css', 'resources/js/app.js'])
</head>
<body>
<div class="h-screen w-screen bg-red-500"></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
// tailwind.config.js
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./resources/**/*.blade.php",
],
theme: {
extend: {},
},
plugins: [],
};
Run Code Online (Sandbox Code Playgroud)
/* resources\css\app.css */
@tailwind base;
@tailwind components;
@tailwind utilities;
Run Code Online (Sandbox Code Playgroud)
然后:
npm run build
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5896 次 |
| 最近记录: |