Skip to content

Commit

Permalink
添加国际化,环境编译
Browse files Browse the repository at this point in the history
  • Loading branch information
jsxiaosi committed Jun 16, 2021
1 parent 2911a8e commit 73fb842
Show file tree
Hide file tree
Showing 15 changed files with 1,635 additions and 107 deletions.
1 change: 1 addition & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_USE_MOCK = "xiaosisi"
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_USE_MOCK = "lalalalallala"
12 changes: 12 additions & 0 deletions build/vite/plugin/i18n.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// https://github.com/intlify/vite-plugin-vue-i18n
import vueI18n from '@intlify/vite-plugin-vue-i18n'

export function configI18nPlugin() {
let options = {
include: 'src/locales/**'
}
const plugin = [
vueI18n(options)
]
return plugin
}
8 changes: 7 additions & 1 deletion build/vite/plugin/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import vue from '@vitejs/plugin-vue'

// 按需加载样式配置
import { configStylePlugin } from './style'
// 主题切换配置
import { configThemePlugin } from './theme';
// svg配置
import { configSvgPlugin } from './svg';
// 国际化翻译配置
import { configI18nPlugin } from './i18n'

export function createVitePlugins() {
const vitePlugins = [
Expand All @@ -11,6 +16,7 @@ export function createVitePlugins() {
vitePlugins.push(configStylePlugin())
vitePlugins.push(configThemePlugin())
vitePlugins.push(configSvgPlugin())

vitePlugins.push(configI18nPlugin())

return vitePlugins
}
1 change: 1 addition & 0 deletions build/vite/plugin/style.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://github.com/anncwb/vite-plugin-style-import/blob/main/README.zh_CN.md
import styleImport from 'vite-plugin-style-import'

export function configStylePlugin(){
Expand Down
1 change: 1 addition & 0 deletions build/vite/plugin/svg.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://github.com/anncwb/vite-plugin-svg-icons/blob/main/README.zh_CN.md
import viteSvgIcons from 'vite-plugin-svg-icons';
import path from 'path';

Expand Down
2 changes: 2 additions & 0 deletions build/vite/plugin/theme.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// https://github.com/GitOfZGT/vite-plugin-theme-preprocessor

import path from 'path'
import themePreprocessorPlugin, {
getModulesScopeGenerater,
Expand Down
Loading

0 comments on commit 73fb842

Please sign in to comment.