修改打包方式
This commit is contained in:
parent
139f198ad5
commit
f256740dcb
|
|
@ -32,14 +32,14 @@ gulp.task('create:versionCatalog', gulp.series('build', function () {
|
||||||
// 替换${versionPath}/static/js/manifest.js window.SITE_CONFIG.cdnUrl占位变量
|
// 替换${versionPath}/static/js/manifest.js window.SITE_CONFIG.cdnUrl占位变量
|
||||||
gulp.task('replace:cdnUrl', gulp.series('create:versionCatalog', function () {
|
gulp.task('replace:cdnUrl', gulp.series('create:versionCatalog', function () {
|
||||||
return gulp.src(`${versionPath}/static/js/manifest.js`)
|
return gulp.src(`${versionPath}/static/js/manifest.js`)
|
||||||
.pipe($.replace(new RegExp(`"${require('./config').build.assetsPublicPath}"`, 'g'), 'window.SITE_CONFIG.cdnUrl + "/"'))
|
.pipe($.revReplace(new RegExp(`"${require('./config').build.assetsPublicPath}"`, 'g'), 'window.SITE_CONFIG.cdnUrl + "/"'))
|
||||||
.pipe(gulp.dest(`${versionPath}/static/js/`))
|
.pipe(gulp.dest(`${versionPath}/static/js/`))
|
||||||
}))
|
}))
|
||||||
|
|
||||||
// 替换${versionPath}/static/config/index-${env}.js window.SITE_CONFIG['version']配置变量
|
// 替换${versionPath}/static/config/index-${env}.js window.SITE_CONFIG['version']配置变量
|
||||||
gulp.task('replace:version', gulp.series('create:versionCatalog', function () {
|
gulp.task('replace:version', gulp.series('create:versionCatalog', function () {
|
||||||
return gulp.src(`${versionPath}/static/config/index-${env}.js`)
|
return gulp.src(`${versionPath}/static/config/index-${env}.js`)
|
||||||
.pipe($.replace(/window.SITE_CONFIG\['version'\] = '.*'/g, `window.SITE_CONFIG['version'] = '${version}'`))
|
.pipe($.revReplace(/window.SITE_CONFIG\['version'\] = '.*'/g, `window.SITE_CONFIG['version'] = '${version}'`))
|
||||||
.pipe(gulp.dest(`${versionPath}/static/config/`))
|
.pipe(gulp.dest(`${versionPath}/static/config/`))
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue