瀏覽代碼

:sparkles: wave-ui working with tree shaking

tags/0.0.1
J 3 年之前
父節點
當前提交
9092c03a55

+ 247
- 2016
frontend/package-lock.json
文件差異過大導致無法顯示
查看文件


+ 2
- 7
frontend/package.json 查看文件

@@ -22,19 +22,14 @@
22 22
         "@prettier/plugin-pug": "^1.19.2",
23 23
         "@vitejs/plugin-vue": "^2.2.4",
24 24
         "@vue/compiler-sfc": "^3.2.31",
25
-        "autoprefixer": "^10.4.2",
26 25
         "cross-env": "^7.0.3",
27 26
         "eslint": "^8.11.0",
28 27
         "eslint-config-prettier": "^8.5.0",
29 28
         "eslint-plugin-vue": "^8.5.0",
30
-        "naive-ui": "^2.26.4",
31
-        "postcss": "^8.4.8",
32
-        "postcss-calc": "^8.2.4",
33
-        "postcss-import": "^14.0.2",
34
-        "precss": "^4.0.0",
35 29
         "pug": "^3.0.2",
36 30
         "pug-plain-loader": "^1.1.0",
37
-        "sugarss": "^4.0.1",
31
+        "sass": "^1.54.4",
32
+        "sass-loader": "^10.3.1",
38 33
         "vite": "^2.8.6",
39 34
         "vite-fs": "^0.0.2",
40 35
         "watch": "^1.0.2"

+ 0
- 9
frontend/postcss.config.js 查看文件

@@ -1,9 +0,0 @@
1
-module.exports = {
2
-    parser: 'sugarss',
3
-    plugins: [
4
-        require('postcss-import'),
5
-        require('postcss-calc'),
6
-        require('precss'),
7
-        require('autoprefixer'),
8
-    ],
9
-}

+ 2
- 2
frontend/src/App.vue 查看文件

@@ -3,8 +3,7 @@ w-app
3 3
     w-badge
4 4
         template(#badge) 3
5 5
             w-button(color="primary")
6
-                w-icon(class="mr1") mdi mdi-email
7
-                    Emails
6
+                w-icon(class="mr1") mdi mdi-email Emails
8 7
     w-flex.my12(:gap="3" align-center wrap)
9 8
         | Show menu on:
10 9
         w-menu
@@ -25,6 +24,7 @@ w-app
25 24
 </template>
26 25
 
27 26
 <script>
27
+import 'wave-ui/dist/wave-ui.css'
28 28
 import SideBar from './components/SideBar.vue'
29 29
 
30 30
 import { Chatter, currentProfile, StonkAlert } from './services'

+ 9
- 5
frontend/src/main.js 查看文件

@@ -2,7 +2,8 @@ import { createApp } from 'vue'
2 2
 import router from './router'
3 3
 import { checkLoginStatus } from './router/guards'
4 4
 
5
-import WaveUI from 'wave-ui'
5
+import WaveUI from '../node_modules/wave-ui/src/wave-ui/core'
6
+import components from './wave'
6 7
 
7 8
 import App from './App.vue'
8 9
 import MainNav from './components/MainNav.vue'
@@ -15,8 +16,8 @@ const DEV = import.meta.env.VITE_DEV == 'true'
15 16
 router.beforeEach((to, from, next) => {
16 17
     /**
17 18
      * Skip any route guarding with `npm run dev` or
18
-     * use the loginService to deal with login details
19
-     * Activate with `npm run nodev`
19
+     * Use the loginService to deal with login details
20
+     * NOTE: Activate with `npm run nodev`
20 21
      */
21 22
     if (DEV) {
22 23
         next()
@@ -26,8 +27,11 @@ router.beforeEach((to, from, next) => {
26 27
 })
27 28
 
28 29
 const run = entry => {
29
-    const siimee = createApp(App).use(router)
30
-    new WaveUI(siimee, {})
30
+    const siimee = createApp(App)
31
+    siimee.use(WaveUI, { components })
32
+    new WaveUI(siimee)
33
+
34
+    siimee.use(router)
31 35
     siimee.component('MainNav', MainNav)
32 36
     siimee.mount(entry)
33 37
 }

+ 2
- 1
frontend/src/views/SurveyView.vue 查看文件

@@ -74,7 +74,8 @@ import { maxDistanceKey } from '../../../backend/db/data-generator/config.json'
74 74
 export default {
75 75
     props: {
76 76
         pid: {
77
-            type: Number,
77
+            type: String,
78
+            default: () => '1',
78 79
         },
79 80
     },
80 81
     data() {

+ 28
- 0
frontend/src/wave.js 查看文件

@@ -0,0 +1,28 @@
1
+/**
2
+ * We have to destructure the import for tree-shaking to work
3
+ */
4
+import {
5
+    WAlert,
6
+    WApp,
7
+    WBadge,
8
+    WButton,
9
+    WCard,
10
+    WFlex,
11
+    WIcon,
12
+    WImage,
13
+    WMenu,
14
+    WOverlay,
15
+} from '../node_modules/wave-ui/src/wave-ui/components'
16
+
17
+export default {
18
+    WAlert,
19
+    WApp,
20
+    WBadge,
21
+    WButton,
22
+    WCard,
23
+    WFlex,
24
+    WIcon,
25
+    WImage,
26
+    WMenu,
27
+    WOverlay,
28
+}

+ 10
- 2
frontend/vite.config.js 查看文件

@@ -1,9 +1,17 @@
1 1
 import { defineConfig } from 'vite'
2 2
 import vue from '@vitejs/plugin-vue'
3
-import ViteFS from 'vite-fs'
3
+
4 4
 // https://vitejs.dev/config/
5 5
 export default defineConfig({
6
-    plugins: [vue(), ViteFS()],
6
+    css: {
7
+        preprocessorOptions: {
8
+            scss: {
9
+                additionalData:
10
+                    '$use-layout-classes: false;@import "/src/../node_modules/wave-ui/src/wave-ui/scss/_variables.scss";',
11
+            },
12
+        },
13
+    },
14
+    plugins: [vue()],
7 15
     resolve: {
8 16
         alias: {
9 17
             '@': require('path').resolve(__dirname, 'src'),

Loading…
取消
儲存