代码拉取完成,页面将自动刷新
同步操作将从 浙江易网科技股份有限公司/vue-automation 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
const fs = require('fs')
const path = require('path')
const spritesmithPlugin = require('webpack-spritesmith')
const spritesmithTasks = []
fs.readdirSync('src/assets/sprites').map(dirname => {
if (fs.statSync(`src/assets/sprites/${dirname}`).isDirectory()) {
spritesmithTasks.push(
new spritesmithPlugin({
src: {
cwd: path.resolve(__dirname, `src/assets/sprites/${dirname}`),
glob: '*.png'
},
target: {
image: path.resolve(__dirname, `src/assets/sprites/${dirname}.[hash].png`),
css: [
[path.resolve(__dirname, `src/assets/sprites/_${dirname}.scss`), {
format: 'handlebars_based_template',
spritesheetName: dirname
}]
]
},
customTemplates: {
'handlebars_based_template': path.resolve(__dirname, 'scss.template.hbs')
},
// 样式文件中调用雪碧图地址写法
apiOptions: {
cssImageRef: `~${dirname}.[hash].png`
},
spritesmithOptions: {
algorithm: 'binary-tree',
padding: 10
}
})
)
}
})
const isCDN = process.env.VUE_APP_CDN == 'ON'
const cdn = {
css: [
'https://cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.css'
],
js: [
'https://cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.min.js',
'https://cdn.jsdelivr.net/npm/vue-router@3.1.6/dist/vue-router.min.js',
'https://cdn.jsdelivr.net/npm/vuex@3.3.0/dist/vuex.min.js',
'https://cdn.jsdelivr.net/npm/axios@0.19.2/dist/axios.min.js',
'https://cdn.jsdelivr.net/npm/qs@6.9.3/dist/qs.js',
'https://cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.min.js',
'https://cdn.jsdelivr.net/npm/vue-meta@2.4.0/dist/vue-meta.min.js',
'https://cdn.jsdelivr.net/npm/dayjs@1.8.28/dayjs.min.js'
]
}
const externals = {
'vue': 'Vue',
'vue-router': 'VueRouter',
'vuex': 'Vuex',
'axios': 'axios',
'qs': 'Qs',
'nprogress': 'NProgress',
'vue-meta': 'VueMeta',
'dayjs': 'dayjs'
}
module.exports = {
publicPath: '',
productionSourceMap: false,
configureWebpack: config => {
config.resolve.modules = ['node_modules', 'assets/sprites']
config.plugins.push(...spritesmithTasks)
if (isCDN) {
config.externals = externals
}
},
pluginOptions: {
lintStyleOnBuild: true,
stylelint: {
fix: true
}
},
chainWebpack: config => {
const oneOfsMap = config.module.rule('scss').oneOfs.store
oneOfsMap.forEach(item => {
item.use('sass-resources-loader')
.loader('sass-resources-loader')
.options({
resources: [
'./src/assets/styles/resources/*.scss',
'./src/assets/sprites/*.scss'
]
})
.end()
})
config.module
.rule('svg')
.exclude.add(path.join(__dirname, 'src/assets/icons'))
.end()
config.module
.rule('icons')
.test(/\.svg$/)
.include.add(path.join(__dirname, 'src/assets/icons'))
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.options({
symbolId: 'icon-[name]'
})
.end()
config.plugin('html')
.tap(args => {
args[0].title = process.env.VUE_APP_TITLE;
if (isCDN) {
args[0].cdn = cdn;
}
return args;
})
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。