使用更新的依赖关系伪造版本
原始重播时间 https://github.com/the-simian/gulp-concat-filenames 互联网档案馆的存檔,存档日期2013-12-02
资料
| 软件包 | gulp-concat- 文件名称 |
|---|---|
| 说明 | 类似于concat,但在输出文件中创建了名称列表,而不是内容被合并. |
| 节点版本 | >= 20 |

使用量
基本用途,没有选项.
var concatFilenames = require('gulp-concat-filenames');
var concatFilenamesOptions = {
};
function fileManifest(){
gulp
.src('./lib/**/*.*')
.pipe(concatFilenames('manifest.txt', concatFilenamesOptions))
.pipe(gulp.dest('./output/'));
}
gulp.task('file-manifest', fileManifest);
参数
Gulp concat 文件名需要两个参数: filename 财务报告和审定财务报表 options
QQ 名称 [需求[ . ]
第一个参数是输出文件的名称,文件名列表将被插入 .
备选 [可选[ . ]
第二个参数是可选的(pun意图),是一个具有以下属性的对象:
newline- 用来代替\n为一新行。 默认值将是\nprepend- 在文件名列表的每个条目中预留一些文字append- 文件名列表中每个输入的附加文本template- 函数需要一个参数(文件名),并在格式化后返回字符串。 可用于补充或代替,append财务报告和审定财务报表prependroot- 根文件夹。 包括这个参数会返回相对路径列表,而不是绝对路径.
实例
鉴于文件结构 :
.
+-- somefile.txt
+-- lib
| +-- one.txt
| +-- two.txt
+-- gulpfile.js
var concatFilenames = require('gulp-concat-filenames');
var concatFilenamesOptions = {
root: '/lib',
prepend: '==> ',
append: ' <=='
};
function fileManifest(){
gulp
.src('./lib/**/*.*')
.pipe(concatFilenames('manifest.txt', concatFilenamesOptions))
.pipe(gulp.dest('./output/'));
}
gulp.task('file-manifest', fileManifest);
运行 gulp file-manifest 现在生成一个名为 manifest.txt 内容
==> one.txt <==
==> two.txt <==
或者您也可以使用模板属性来格式化输出.
function fileNameFormatter(filename) {
return 'XXX--' + filename.toUpperCase() + '--YYY';
}
var concatFilenames = require('gulp-concat-filenames');
var concatFilenamesOptions = {
root: '/lib',
template: fileNameFormatter // Pass in a function
};
function fileManifest(){
gulp
.src('./lib/**/*.*')
.pipe(concatFilenames('manifest.txt', concatFilenamesOptions))
.pipe(gulp.dest('./output/'));
}
gulp.task('file-manifest', fileManifest);
运行 gulp file-manifest 现在生成一个名为 manifest.txt 内容
XXX--ONE.TXT--YYY
XXX--TWO.TXT--YYY
贡献 如果你写测试,跟随Semver 并有东西补充, 我喜欢接受拉请求! 有问题吗? 在github上发表文章! < 3