gpt4 book ai didi

node.js - Gulpjs 否定文件然后稍后重新添加

转载 作者:搜寻专家 更新时间:2023-10-31 23:09:18 25 4
gpt4 key购买 nike

有几个这样的问题,但我相信我的情况略有不同,我似乎无法弄清楚。

给定这个伪代码

1.) BaseFolder/*.js except the app.js file
2.) BaseFolder/app/model/*js
3.) BaseFolder/app/store/*.js
4.) BaseFolder/app/view/*.js except Viewport.js
5.) BaseFolder/app/view/Viewport.js
6.) BaseFolder/app/controller/*.js
7.) BaseFolder/app.js

我的问题是我否定了 app.js 文件,然后我想在最后重新添加它。与 Viewport.js 文件相同。

有什么解决办法吗?

这是我尝试过的许多事情之一:

var senchaFiles = [
baseFolderPath + '/*.js',
'!' + baseFolderPath + '/app.js',
baseFolderPath + '/app/model/*.js',
baseFolderPath + '/app/store/*.js',
baseFolderPath + '/app/view/*.js',
'!' + baseFolderPath + '/app/view/Viewport.js',
baseFolderPath + '/app/view/Viewport.js',
baseFolderPath + '/app/controller/*.js',
baseFolderPath + '/app.js'
];

return gulp.src(senchaFiles)
.pipe(concat(folder + '.js'))
// .pipe(sourcemaps.init())
//.pipe(gulp.dest(JS_DIST_FOLDER))
// .pipe(uglify())
// .pipe(rename(folder + '.min.js'))
// .pipe(sourcemaps.write())
.pipe(gulp.dest(JS_DIST_FOLDER));
});

运行此代码不会添加回 app.js 或我否定的 Viewport.js 文件。

最佳答案

Gulp 使用 node-glob syntax .下面的代码可能是您要查找的内容。

var senchaFiles = [
baseFolderPath + '/!(app)*.js', // all, but app.js
baseFolderPath + '/app/model/*.js',
baseFolderPath + '/app/store/*.js',
baseFolderPath + '/app/view/!(Viewport)*.js', // all, but Viewport.js
baseFolderPath + '/app/view/Viewport.js',
baseFolderPath + '/app/controller/*.js',
baseFolderPath + '/app.js'
];

关于node.js - Gulpjs 否定文件然后稍后重新添加,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27622702/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com