ソースを参照

chore: 移除备选图标方案

王家程 1 年間 前
コミット
b43c27a48c
5 ファイル変更10 行追加474 行削除
  1. 0 2
      package.json
  2. 0 452
      pnpm-lock.yaml
  3. 6 8
      src/pages/index/index.vue
  4. 3 3
      uno.config.ts
  5. 1 9
      vite.config.ts

+ 0 - 2
package.json

@@ -85,8 +85,6 @@
     "unplugin-auto-import": "^0.17.6",
     "unplugin-vue-components": "^0.27.0",
     "vite": "^5.2.12",
-    "vite-plugin-purge-icons": "^0.10.0",
-    "vite-plugin-svg-icons": "^2.0.1",
     "vue-eslint-parser": "^9.4.2",
     "vue-tsc": "^2.0.19"
   },

ファイルの差分が大きいため隠しています
+ 0 - 452
pnpm-lock.yaml


+ 6 - 8
src/pages/index/index.vue

@@ -2,7 +2,7 @@
  * @Author: wjc
  * @Date: 2019-08-22 19:41:20
  * @LastEditors: wjc
- * @LastEditTime: 2024-05-29 18:01:04
+ * @LastEditTime: 2024-06-26 15:08:03
  * @Description: 
 -->
 <template>
@@ -10,8 +10,9 @@
     <image class="logo" src="/static/logo.png"></image>
     <view class="text-area">
       <text class="title">{{ title }}</text>
-      <u-button type="primary" text="确定"></u-button>
     </view>
+    <view :class="`i-custom-${icon}`" class="wh-32px text-32px"></view>
+    <u-button type="primary" text="确定"></u-button>
   </view>
 </template>
 
@@ -19,7 +20,8 @@
   export default {
     data() {
       return {
-        title: 'Hello',
+        title: 'unocss 自定义图标',
+        icon: 'anl',
       }
     },
     onLoad() {},
@@ -31,6 +33,7 @@
   .content {
     display: flex;
     flex-direction: column;
+    grid-gap: 8px;
     align-items: center;
     justify-content: center;
   }
@@ -44,11 +47,6 @@
     margin-left: auto;
   }
 
-  .text-area {
-    display: flex;
-    justify-content: center;
-  }
-
   .title {
     font-size: 36rpx;
     color: #8f8f94;

+ 3 - 3
uno.config.ts

@@ -2,7 +2,7 @@
  * @Author: wjc
  * @Date: 2023-05-07 20:59:28
  * @LastEditors: wjc
- * @LastEditTime: 2024-06-11 15:11:30
+ * @LastEditTime: 2024-06-26 15:00:37
  * @Description:
  */
 import {
@@ -13,7 +13,7 @@ import {
   transformerVariantGroup,
 } from 'unocss'
 import { FileSystemIconLoader } from '@iconify/utils/lib/loader/node-loaders'
-// import iconList from './utils/icons'
+import iconList from './src/utils/icons'
 
 export default defineConfig({
   presets: [
@@ -44,7 +44,7 @@ export default defineConfig({
     [/^wh-(.+)$/, ([, d]) => ({ width: `${d}`, height: `${d}` })],
     [/^bg-color-(\d+)$/, ([, d]) => ({ 'background-color': `${d}` })],
   ],
-  // safelist: iconList,
+  safelist: iconList,
   shortcuts: {
     'wh-full': 'w-full h-full',
     'mp-0': 'm-0 p-0',

+ 1 - 9
vite.config.ts

@@ -2,15 +2,13 @@
  * @Author: wjc
  * @Date: 2024-05-27 10:17:11
  * @LastEditors: wjc
- * @LastEditTime: 2024-06-25 16:19:01
+ * @LastEditTime: 2024-06-26 15:13:07
  * @Description:
  */
 import path from 'node:path'
 import { defineConfig, loadEnv } from 'vite'
 import UnoCSS from 'unocss/vite'
 import uni from '@dcloudio/vite-plugin-uni'
-import PurgeIcons from 'vite-plugin-purge-icons'
-import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
 import AutoImport from 'unplugin-auto-import/vite'
 import Components from 'unplugin-vue-components/vite'
 
@@ -46,11 +44,6 @@ export default defineConfig(({ mode }) => {
       UniLayouts(),
       // UniPages(),
       UnoCSS(),
-      createSvgIconsPlugin({
-        iconDirs: [pathResolve('src/static/icons')],
-        symbolId: 'icon-[dir]-[name]',
-        svgoOptions: true,
-      }),
       Components({
         // 按需导入组件,相关组件声明放置于 components.d.ts
         dts: './types/components.d.ts',
@@ -66,7 +59,6 @@ export default defineConfig(({ mode }) => {
         imports: ['vue', 'uni-app'], // 限定范围为 vue, uni-app
         dts: 'types/auto-import.d.ts', // 自动生成 'auto-import.d.ts'全局声明
       }),
-      PurgeIcons(),
     ],
   }
 })

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません