From f256740dcb3cd3321636d0bb8a752ed232125761 Mon Sep 17 00:00:00 2001 From: YeMingfei666 <1619116647@qq.com> Date: Thu, 26 Dec 2024 17:37:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=89=93=E5=8C=85=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gulpfile.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 7059ca6..0033485 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -32,14 +32,14 @@ gulp.task('create:versionCatalog', gulp.series('build', function () { // 替换${versionPath}/static/js/manifest.js window.SITE_CONFIG.cdnUrl占位变量 gulp.task('replace:cdnUrl', gulp.series('create:versionCatalog', function () { 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/`)) })) // 替换${versionPath}/static/config/index-${env}.js window.SITE_CONFIG['version']配置变量 gulp.task('replace:version', gulp.series('create:versionCatalog', function () { 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/`)) })) @@ -61,7 +61,7 @@ gulp.task('clean', function () { gulp.task('build-end', function () { console.log('--builed-end--') // del([`${distPath}/static`, `${versionPath}/static/config`]); - return del([`${distPath}/static`, `${versionPath}/static/config`]); + return del([`${distPath}/static`, `${versionPath}/static/config`]); }) env = process.env.npm_config_qa ? 'qa' : process.env.npm_config_uat ? 'uat' : 'prod'; @@ -69,7 +69,7 @@ env = process.env.npm_config_qa ? 'qa' : process.env.npm_config_uat ? 'uat' : 'p gulp.task('default', gulp.series('clean', gulp.parallel('create:versionCatalog', 'replace:cdnUrl', 'replace:version', 'concat:config'), - 'build','build-end') + 'build', 'build-end') ) @@ -81,22 +81,22 @@ gulp.task('default', // 开始打包编译 // 开始打包编译 gulp.task('default', gulp.series('build','create:versionCatalog', 'replace:cdnUrl', 'replace:version', 'concat:config', function (done) { - // 清除, 编译 / 处理项目中产生的文件 - del([`${distPath}/static`, `${versionPath}/static/config`]) - done(); + // 清除, 编译 / 处理项目中产生的文件 + del([`${distPath}/static`, `${versionPath}/static/config`]) + done(); })) })); */ /* gulp.task('default', gulp.series('clean', function (done) { - // 获取环境配置 - env = process.env.npm_config_qa ? 'qa' : process.env.npm_config_uat ? 'uat' : 'prod' + // 获取环境配置 + env = process.env.npm_config_qa ? 'qa' : process.env.npm_config_uat ? 'uat' : 'prod' // 开始打包编译 // 开始打包编译 - gulp.task('default', gulp.series('build','create:versionCatalog', 'replace:cdnUrl', 'replace:version', 'concat:config', function (done) { - // 清除, 编译 / 处理项目中产生的文件 - del([`${distPath}/static`, `${versionPath}/static/config`]) - done(); - })) + gulp.task('default', gulp.series('build','create:versionCatalog', 'replace:cdnUrl', 'replace:version', 'concat:config', function (done) { + // 清除, 编译 / 处理项目中产生的文件 + del([`${distPath}/static`, `${versionPath}/static/config`]) + done(); + })) })); */