From 7cc90b8a0d5ed8b436d2badee8ad8e317eb82555 Mon Sep 17 00:00:00 2001 From: rizary Date: Sat, 21 Jun 2025 17:58:14 +0700 Subject: [PATCH] add tailwindcss and daisyui, pinia and fix build error when integrating vue with electron --- .config/nuxt.ts | 57 +- .config/tailwind.config.js | 27 + .config/vite.forge.ts | 1 + app/app.vue | 37 +- app/assets/css/main.css | 14 + app/assets/css/ui.tailwind.css | 43 - app/assets/scss/_main.scss | 29 - app/assets/scss/_transitions.scss | 83 - app/assets/scss/app.scss | 2 - app/{utils => composables}/electron.ts | 0 app/layouts/default.vue | 40 +- app/pages/index.vue | 103 +- app/stores/app.ts | 99 + electron/main.ts | 28 +- package-lock.json | 10072 ----------------------- package.json | 25 +- pnpm-lock.yaml | 2254 +---- pnpm-workspace.yaml | 8 +- 18 files changed, 689 insertions(+), 12233 deletions(-) create mode 100644 .config/tailwind.config.js create mode 100644 app/assets/css/main.css delete mode 100644 app/assets/css/ui.tailwind.css delete mode 100644 app/assets/scss/_main.scss delete mode 100644 app/assets/scss/_transitions.scss delete mode 100644 app/assets/scss/app.scss rename app/{utils => composables}/electron.ts (100%) create mode 100644 app/stores/app.ts delete mode 100644 package-lock.json diff --git a/.config/nuxt.ts b/.config/nuxt.ts index bf66ad1..ef87f76 100644 --- a/.config/nuxt.ts +++ b/.config/nuxt.ts @@ -1,8 +1,8 @@ +import tailwindcss from "@tailwindcss/vite"; import { APP } from "../app/utils/app"; export default defineNuxtConfig({ modules: [ - "@nuxt/ui", "@nuxt/eslint", "@pinia/nuxt" ], @@ -19,23 +19,32 @@ export default defineNuxtConfig({ } }, css: [ - "~/assets/css/ui.tailwind.css", - "~/assets/scss/app.scss" + "~/assets/css/main.css" ], + + vite: { + plugins: [ + tailwindcss(), + ], + server: { + watch: { + ignored: ["./docker-data/*"], + }, + }, + }, + + postcss: { + plugins: { + "@tailwindcss/postcss": {} + } + }, + router: { options: { hashMode: true } }, - colorMode: { - preference: "dark", - fallback: "dark", - storageKey: "nuxt-color-mode" - }, - ui: { - colorMode: true, - fonts: false - }, + future: { compatibilityVersion: 4 }, features: { inlineStyles: false @@ -46,31 +55,9 @@ export default defineNuxtConfig({ renderJsonPayloads: false }, compatibilityDate: "2025-05-26", - vite: { - css: { - preprocessorOptions: { - scss: { - api: "modern-compiler", - silenceDeprecations: ["mixed-decls", "color-functions", "import", "global-builtin"] - } - } - } - }, - postcss: { - plugins: { - "@tailwindcss/postcss": {} - } - }, eslint: { config: { - autoInit: false, stylistic: true } - }, - icon: { - provider: "iconify", - clientBundle: { - scan: true - } } -}); \ No newline at end of file +}) \ No newline at end of file diff --git a/.config/tailwind.config.js b/.config/tailwind.config.js new file mode 100644 index 0000000..369858e --- /dev/null +++ b/.config/tailwind.config.js @@ -0,0 +1,27 @@ +/** @type {import('tailwindcss').Config} */ +module.exports = { + content: [ + "./app/components/**/*.{js,vue,ts}", + "./app/layouts/**/*.vue", + "./app/pages/**/*.vue", + "./app/plugins/**/*.{js,ts}", + "./app.vue", + "./app/**/*.vue" + ], + theme: { + extend: {}, + }, + plugins: [ + require('daisyui'), + ], + daisyui: { + themes: ["dark", "light", "night", "forest", "aqua", "winter"], + darkTheme: "dark", + base: true, + styled: true, + utils: true, + prefix: "", + logs: true, + themeRoot: ":root", + } +} \ No newline at end of file diff --git a/.config/vite.forge.ts b/.config/vite.forge.ts index db37cae..0225377 100644 --- a/.config/vite.forge.ts +++ b/.config/vite.forge.ts @@ -7,6 +7,7 @@ const copyNuxtOutput: Plugin = { async closeBundle () { const outputDir = fileURLToPath(new URL("../.output/public", import.meta.url)); const targetDir = fileURLToPath(new URL("../.vite/renderer", import.meta.url)); + await mkdir(targetDir, { recursive: true }); await cp(outputDir, targetDir, { recursive: true, force: true }); } diff --git a/app/app.vue b/app/app.vue index d2f121a..1437291 100644 --- a/app/app.vue +++ b/app/app.vue @@ -1,40 +1,15 @@