|
|
@@ -43,13 +43,28 @@ gulp.task('replace:version', ['create:versionCatalog'], function () {
|
|
|
.pipe(gulp.dest(`${versionPath}/static/config/`))
|
|
|
});
|
|
|
|
|
|
+// 替换${versionPath}/static/config/index-${env}.js window.SITE_CONFIG['systemName']配置变量
|
|
|
+gulp.task('replace:systemName', ['replace:version'], function () {
|
|
|
+ // 可根据需要自定义 systemName
|
|
|
+ const systemName = process.env.npm_config_systemname || '木之云数字化平台';
|
|
|
+ // const systemName = process.env.npm_config_systemname || '昌柘伟业数字化平台';
|
|
|
+ return gulp.src(`${versionPath}/static/config/index-${env}.js`)
|
|
|
+ .pipe($.replace(/window\.SITE_CONFIG\['systemName'\] = '.*'/g, `window.SITE_CONFIG['systemName'] = '${systemName}'`))
|
|
|
+ .pipe(gulp.dest(`${versionPath}/static/config/`));
|
|
|
+});
|
|
|
+
|
|
|
// 合并${versionPath}/static/config/[index-${env}, init].js 至 ${distPath}/config/index.js
|
|
|
gulp.task('concat:config', ['replace:version'], function () {
|
|
|
return gulp.src([`${versionPath}/static/config/index-${env}.js`, `${versionPath}/static/config/init.js`])
|
|
|
.pipe($.concat('index.js'))
|
|
|
.pipe(gulp.dest(`${distPath}/config/`))
|
|
|
});
|
|
|
-
|
|
|
+// 修改合并任务依赖,确保systemName已替换
|
|
|
+gulp.task('concat:config', ['replace:systemName'], function () {
|
|
|
+ return gulp.src([`${versionPath}/static/config/index-${env}.js`, `${versionPath}/static/config/init.js`])
|
|
|
+ .pipe($.concat('index.js'))
|
|
|
+ .pipe(gulp.dest(`${distPath}/config/`));
|
|
|
+});
|
|
|
// 清空
|
|
|
gulp.task('clean', function () {
|
|
|
return del([versionPath])
|