Skip to content

Commit 299f196

Browse files
author
zaizhou.sym
committed
feat(pri): 优化函数
1 parent 12cf3a3 commit 299f196

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

src/utils/ts-plus-babel.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,14 @@ import { babelPluginTransformImport } from './babel-plugin-transfer-import';
1717
import { PackageInfo } from './define';
1818
import { runWebpack } from './webpack';
1919

20-
function getGulpByWatch(watch: boolean, filesPath: string) {
20+
function getGulpByWatch(watch: boolean, filesPath: string | string[]) {
2121
if (watch) {
2222
return gulpWatch(filesPath);
2323
}
2424
/** 文件匹配 */
2525
return gulp.src(filesPath);
2626
}
2727

28-
function getCssByWatch(watch: boolean, filesPath: Array<any>) {
29-
if (watch) {
30-
return gulpWatch(filesPath);
31-
}
32-
/** 文件匹配 */
33-
return gulp.src(filesPath);
34-
}
3528
const buildTs = (watch: boolean, outdir: string, babelOptions: any, wholeProject: boolean, sourcePath: string) => {
3629
const targetPath = wholeProject
3730
? path.join(pri.projectRootPath, '{src,packages}/**/*.{ts,tsx}')
@@ -67,7 +60,7 @@ const buildSassAndLess = (watch: boolean, outdir: string, wholeProject: boolean,
6760
const targetScssPath = getStyleFilePath('scss', wholeProject, sourcePath);
6861
const targetLessPath = getStyleFilePath('less', wholeProject, sourcePath);
6962
return new Promise((resolve, reject) => {
70-
getCssByWatch(watch, [targetScssPath, targetLessPath])
63+
getGulpByWatch(watch, [targetScssPath, targetLessPath])
7164
.pipe(
7265
gulpSass({
7366
includePaths: path.join(pri.projectRootPath, 'node_modules'),

0 commit comments

Comments
 (0)