2025-02-06- JavaScript 系列八:第5課 ── 體重追蹤應用程式-tailwind.config.js位置
2025-02-06- JavaScript 系列八:第5課 ── 體重追蹤應用程式-tailwind.config.js位置
✅ 你的專案結構說明:
| 1 | AppleLilyShop/ | 
✅ tailwind.config.js 擺哪裡?
👉 放在 vite.config.js 同一層(即專案根目錄),你這樣寫就對:
| 1 | AppleLilyShop/ | 
✅ 加入主題顏色步驟(簡版):
- **建立/修改 - tailwind.config.js**:- 1 
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14- // tailwind.config.js 
 export default {
 theme: {
 extend: {
 colors: {
 lily: {
 light: '#ead7da',
 dark: '#d4a2a7',
 chart: '#f5e5e7',
 },
 },
 },
 },
 }
- 在程式中使用主題顏色 class: - 1 
 2
 3- <div class="bg-lily-light"> 
 <button class="bg-lily-dark text-white">新增</button>
 </div>
- 重新啟動 Vite 開發伺服器(Tailwind 變更要重啟): - 1 - npm run dev