代码拉取完成,页面将自动刷新
同步操作将从 巡云/巡云轻论坛前台电脑版前端 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import legacy from '@vitejs/plugin-legacy'
import prismjs from "vite-plugin-prismjs";
//把原先 @import 方式引入的变量,通过 readFile 读成字符串传递给 additionalData。解决scss @use 时,把$--color-primary这种变量作为private处理 additionalData: '@use \"./src/style/variables.scss\" as *; $-- color-primary: #19D4AE;'
//import fs from 'fs'
//const scssVariables = fs.readFileSync(path.join(__dirname, '../', 'assets/css/global.scss'), 'utf8')
// https://vitejs.dev/config/
export default defineConfig({
resolve: {
//别名 以根目录的方式定义相对路径
alias: {
"@": path.resolve(__dirname, "src"),
//"@components": path.resolve(__dirname, "src/components")
vue: 'vue/dist/vue.esm-bundler.js',//编译器版本支持运行时编译
},
},
//plugins: [vue()]
plugins: [
vue({
template: {
compilerOptions: {
isCustomElement: (tag) => ['player','hide'].includes(tag),//预编译时支持原生自定义元素 player为引入的播放器使用标签
}
}
}),
//Prism代码高亮插件
prismjs({
languages: ["xml", "css", "html", "javascript", "java", "perl", "python", "ruby", "go", "cpp", "cs", "bash"],
// languages: 'all',
plugins: ["line-numbers","toolbar","copy-to-clipboard"], //配置显示行号插件 copy-to-clipboard
theme: "default", //主题名称 default solarizedlight
css: true,
}),
AutoImport({
resolvers: [ElementPlusResolver()],
}),
Components({
resolvers: [ElementPlusResolver({
importStyle: "sass",
directives: true,//自动导入指令
})],
}),
legacy({
targets: ['defaults', 'ie >= 11', 'chrome 52','Firefox ESR',], //需要兼容的目标列表,可以设置多个
}),
],
css: {
preprocessorOptions: {
scss: {
/*
引入var.scss全局预定义变量,
如果引入多个文件,
可以使用
'@import "@/assets/scss/globalVariable1.scss";@import "@/assets/scss/globalVariable2.scss";'
这种格式
additionalData 引入的文件最好只写scss变量,不要写css变量。
@use引入文件时 Sass定义私有成员是使用-或开头,定义$--color-black-10这种是私有变量
*/
additionalData: `@use "@/assets/css/custom-elementPlus.scss" as *;@use "@/assets/css/global.scss" as *;`//加载各模块样式
// additionalData:scssVariables
// additionalData: `@use "@/assets/css/custom-elementPlus.scss" as *;@import "@/assets/css/global.scss";`//加载各模块样式
},
}
},
//assets目录新增支持的静态资源文件 (和assets.d.ts配合使用) https://cn.vitejs.dev/config/shared-options.html#assetsinclude
assetsInclude: ['**/*.cur'],
build: {
target: 'es2015',
outDir: './dist/',
cssCodeSplit: true
}
})
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。