File tree Expand file tree Collapse file tree 1 file changed +12
-12
lines changed
Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change 1- # Generating a file per folder
1+ # 每个文件夹生成单独一个文件
22
3- If you have a set of folders, and wish to perform a set of tasks on each, for instance ...
3+ 如果你有一整套的文件目录,并且希望执行相应的一套任务,比如 ...
44
55```
66/scripts
77/scripts/jquery/*.js
88/scripts/angularjs/*.js
99```
1010
11- ...and want to end up with ...
11+ ...然后希望完成如下的结果h ...
1212
1313```
1414/scripts
1515/scripts/jquery.min.js
1616/scripts/angularjs.min.js
1717```
1818
19- ...you'll need to do something like the following ...
19+ ...你将会需要像下面所示的东西 ...
2020
2121``` javascript
2222var fs = require (' fs' );
@@ -40,11 +40,11 @@ gulp.task('scripts', function() {
4040 var folders = getFolders (scriptsPath);
4141
4242 var tasks = folders .map (function (folder ) {
43- // concat into foldername.js
44- // write to output
45- // minify
46- // rename to folder.min.js
47- // write to output again
43+ // 拼接成 foldername.js
44+ // 写入输出
45+ // 压缩
46+ // 重命名为 folder.min.js
47+ // 再一次写入输出
4848 return gulp .src (path .join (scriptsPath, folder, ' /*.js' ))
4949 .pipe (concat (folder + ' .js' ))
5050 .pipe (gulp .dest (scriptsPath))
@@ -57,7 +57,7 @@ gulp.task('scripts', function() {
5757});
5858```
5959
60- A few notes:
60+ 注:
6161
62- - ` folders.map ` - executes the function once per folder, and returns the async stream
63- - ` merge ` - combines the streams and ends only when all streams emitted end
62+ - ` folders.map ` - 在每一个文件夹中分别执行一次函数,并且返回异步 stream
63+ - ` merge ` - 汇总 stream,并且在所有的 stream 都完成后完成
You can’t perform that action at this time.
0 commit comments