elearning/Frontend-Learner/nuxt.config.ts

85 lines
3.1 KiB
TypeScript
Raw Normal View History

2026-01-13 10:46:40 +07:00
// Nuxt 3 + Quasar + Tailwind + TypeScript
// Configuration for E-Learning Platform - Refreshed
// ไฟล์ตั้งค่าหลักของ Nuxt.js ใช้สำหรับกำหนด Modules, Plugins, CSS และ Environment Variables
2026-01-13 10:46:40 +07:00
export default defineNuxtConfig({
// Modules ที่ใช้ในโปรเจกต์
// - nuxt-quasar-ui: สำหรับ UI Component Library (Quasar)
// - @nuxtjs/tailwindcss: สำหรับ Utility-first CSS Framework
// - @nuxtjs/i18n: สำหรับระบบหลายภาษา (Internationalization)
modules: ["nuxt-quasar-ui", "@nuxtjs/tailwindcss", "@nuxtjs/i18n"],
// การตั้งค่า i18n (ระบบภาษา)
i18n: {
strategy: 'no_prefix', // ไม่ใส่ prefix URL สำหรับภาษา default
defaultLocale: 'th', // ภาษาเริ่มต้นเป็นภาษาไทย
langDir: 'locales', // โฟลเดอร์เก็บไฟล์แปลภาษา
locales: [
{ code: 'th', name: 'ไทย', iso: 'th-TH', file: 'th.json' },
{ code: 'en', name: 'English', iso: 'en-US', file: 'en.json' }
],
detectBrowserLanguage: {
useCookie: true,
cookieKey: 'i18n_redirected',
redirectOn: 'root'
}
},
// ไฟล์ CSS หลักของโปรเจกต์
2026-01-19 15:14:30 +07:00
css: ["~/assets/css/main.css"],
2026-01-13 10:46:40 +07:00
typescript: {
2026-01-19 15:14:30 +07:00
strict: true,
2026-01-13 10:46:40 +07:00
},
// การตั้งค่า Quasar Framework
2026-01-13 10:46:40 +07:00
quasar: {
extras: {
fontIcons: ["material-icons"],
},
plugins: ["Notify", "Dialog"], // เปิดใช้ Plugin Notify และ Dialog
2026-01-13 10:46:40 +07:00
config: {
brand: { // กำหนดชุดสีหลัก (Theme Colors)
2026-01-19 15:14:30 +07:00
primary: "#4b82f7",
secondary: "#2f5ed7",
accent: "#44d4a8",
dark: "#0f1827",
},
},
2026-01-13 10:46:40 +07:00
},
// กำหนดให้ Nuxt สแกน Components ในโฟลเดอร์ ~/components โดยอัตโนมัติ
2026-01-13 10:46:40 +07:00
components: [
{
2026-01-19 15:14:30 +07:00
path: "~/components",
pathPrefix: false, // เรียกใช้ Component ได้โดยไม่ต้องมี prefix ชื่อโฟลเดอร์
2026-01-19 15:14:30 +07:00
},
2026-01-13 10:46:40 +07:00
],
// การตั้งค่า HTML Head (Meta tags, Google Fonts)
2026-01-13 10:46:40 +07:00
app: {
head: {
htmlAttrs: {
2026-01-19 15:14:30 +07:00
lang: 'th',
2026-01-13 10:46:40 +07:00
},
2026-01-19 15:14:30 +07:00
title: "E-Learning System",
meta: [
{ name: "viewport", content: "width=device-width, initial-scale=1" },
],
2026-01-13 10:46:40 +07:00
link: [
{
2026-01-19 15:14:30 +07:00
rel: "stylesheet",
// โหลด Font: Inter, Prompt, Sarabun
href: "https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Prompt:wght@300;400;500;600;700;800;900&family=Sarabun:wght@300;400;500;600;700;800&family=Poppins:wght@300;400;500;600;700;800;900&display=swap",
2026-01-19 15:14:30 +07:00
},
],
},
2026-01-13 10:46:40 +07:00
},
// Environment Variables ที่ใช้ในโปรเจกต์ (เข้าถึงได้ทั้ง Server และ Client)
2026-01-14 15:15:31 +07:00
runtimeConfig: {
public: {
apiBase: process.env.NUXT_PUBLIC_API_BASE || 'http://localhost:4000/api'
}
}
2026-01-19 15:14:30 +07:00
});