fix style and add plugin
This commit is contained in:
parent
d95fab75a7
commit
c7c63c51de
28
Vite/plugins/compression.ts
Normal file
28
Vite/plugins/compression.ts
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import compression from 'vite-plugin-compression';
|
||||||
|
|
||||||
|
export default function createCompression(env) {
|
||||||
|
const { VITE_BUILD_COMPRESS } = env;
|
||||||
|
const plugin: any[] = [];
|
||||||
|
if (VITE_BUILD_COMPRESS) {
|
||||||
|
const compressList = VITE_BUILD_COMPRESS.split(',');
|
||||||
|
if (compressList.includes('gzip')) {
|
||||||
|
// http://doc.ruoyi.vip/ruoyi-vue/other/faq.html#使用gzip解压缩静态文件
|
||||||
|
plugin.push(
|
||||||
|
compression({
|
||||||
|
ext: '.gz',
|
||||||
|
deleteOriginFile: false
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (compressList.includes('brotli')) {
|
||||||
|
plugin.push(
|
||||||
|
compression({
|
||||||
|
ext: '.br',
|
||||||
|
algorithm: 'brotliCompress',
|
||||||
|
deleteOriginFile: false
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return plugin;
|
||||||
|
}
|
@ -4,6 +4,7 @@ import createAutoImport from './auto-import';
|
|||||||
import createComponents from './components';
|
import createComponents from './components';
|
||||||
import createIcons from './icons';
|
import createIcons from './icons';
|
||||||
import createSvgIconsPlugin from './svg-icon';
|
import createSvgIconsPlugin from './svg-icon';
|
||||||
|
import createCompression from './compression';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
export default (viteEnv, isBuild = false): [] => {
|
export default (viteEnv, isBuild = false): [] => {
|
||||||
@ -12,7 +13,8 @@ export default (viteEnv, isBuild = false): [] => {
|
|||||||
vitePlusgins.push(createUnoCss());
|
vitePlusgins.push(createUnoCss());
|
||||||
vitePlusgins.push(createAutoImport(path));
|
vitePlusgins.push(createAutoImport(path));
|
||||||
vitePlusgins.push(createComponents(path));
|
vitePlusgins.push(createComponents(path));
|
||||||
|
vitePlusgins.push(createCompression(viteEnv));
|
||||||
vitePlusgins.push(createIcons());
|
vitePlusgins.push(createIcons());
|
||||||
vitePlusgins.push(createSvgIconsPlugin(path));
|
vitePlusgins.push(createSvgIconsPlugin(path, isBuild));
|
||||||
return vitePlusgins;
|
return vitePlusgins;
|
||||||
};
|
};
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
|
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
|
||||||
export default (path: any) => {
|
export default (path: any, isBuild: boolean) => {
|
||||||
return createSvgIconsPlugin({
|
return createSvgIconsPlugin({
|
||||||
// 指定需要缓存的图标文件夹
|
// 指定需要缓存的图标文件夹
|
||||||
iconDirs: [path.resolve(path.resolve(__dirname, '../../src'), 'assets/icons/svg')],
|
iconDirs: [path.resolve(path.resolve(__dirname, '../../src'), 'assets/icons/svg')],
|
||||||
// 指定symbolId格式
|
// 指定symbolId格式
|
||||||
symbolId: 'icon-[dir]-[name]'
|
symbolId: 'icon-[dir]-[name]',
|
||||||
|
svgoOptions: isBuild
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
@import './btn.scss';
|
@import './btn.scss';
|
||||||
@import './ruoyi.scss';
|
@import './ruoyi.scss';
|
||||||
@import 'animate.css';
|
@import 'animate.css';
|
||||||
// @import 'element-plus/dist/index.css';
|
@import 'element-plus/dist/index.css';
|
||||||
|
|
||||||
body {
|
body {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
2
src/types/auto-imports.d.ts
vendored
2
src/types/auto-imports.d.ts
vendored
@ -8,6 +8,7 @@ declare global {
|
|||||||
const ElMessageBox: typeof import('element-plus/es')['ElMessageBox']
|
const ElMessageBox: typeof import('element-plus/es')['ElMessageBox']
|
||||||
const ElNotification: typeof import('element-plus/es')['ElNotification']
|
const ElNotification: typeof import('element-plus/es')['ElNotification']
|
||||||
const ElSelect: typeof import('element-plus/es')['ElSelect']
|
const ElSelect: typeof import('element-plus/es')['ElSelect']
|
||||||
|
const ElTable: typeof import('element-plus/es')['ElTable']
|
||||||
const acceptHMRUpdate: typeof import('pinia')['acceptHMRUpdate']
|
const acceptHMRUpdate: typeof import('pinia')['acceptHMRUpdate']
|
||||||
const asyncComputed: typeof import('@vueuse/core')['asyncComputed']
|
const asyncComputed: typeof import('@vueuse/core')['asyncComputed']
|
||||||
const autoResetRef: typeof import('@vueuse/core')['autoResetRef']
|
const autoResetRef: typeof import('@vueuse/core')['autoResetRef']
|
||||||
@ -293,6 +294,7 @@ declare module 'vue' {
|
|||||||
readonly ElMessageBox: UnwrapRef<typeof import('element-plus/es')['ElMessageBox']>
|
readonly ElMessageBox: UnwrapRef<typeof import('element-plus/es')['ElMessageBox']>
|
||||||
readonly ElNotification: UnwrapRef<typeof import('element-plus/es')['ElNotification']>
|
readonly ElNotification: UnwrapRef<typeof import('element-plus/es')['ElNotification']>
|
||||||
readonly ElSelect: UnwrapRef<typeof import('element-plus/es')['ElSelect']>
|
readonly ElSelect: UnwrapRef<typeof import('element-plus/es')['ElSelect']>
|
||||||
|
readonly ElTable: UnwrapRef<typeof import('element-plus/es')['ElTable']>
|
||||||
readonly acceptHMRUpdate: UnwrapRef<typeof import('pinia')['acceptHMRUpdate']>
|
readonly acceptHMRUpdate: UnwrapRef<typeof import('pinia')['acceptHMRUpdate']>
|
||||||
readonly asyncComputed: UnwrapRef<typeof import('@vueuse/core')['asyncComputed']>
|
readonly asyncComputed: UnwrapRef<typeof import('@vueuse/core')['asyncComputed']>
|
||||||
readonly autoResetRef: UnwrapRef<typeof import('@vueuse/core')['autoResetRef']>
|
readonly autoResetRef: UnwrapRef<typeof import('@vueuse/core')['autoResetRef']>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user