@fomantic/gulp-concat-filenames

中文文档
3.0.0发布于 2026/07/18TypeScriptCommonJS近 30 天下载 2.3万

类似于 concat,但创建一个文件,其中包含文件名列表,而非文件内容.

中文使用文档
文档目录3 节
  1. 使用更新的依赖关系伪造版本
  2. 使用量
  3. 基本用途,没有选项.

使用更新的依赖关系伪造版本

原始重播时间 https://github.com/the-simian/gulp-concat-filenames 互联网档案馆的存檔,存档日期2013-12-02

资料

软件包gulp-concat- 文件名称
说明类似于concat,但在输出文件中创建了名称列表,而不是内容被合并.
节点版本>= 20

gulp-concat-filenames

使用量

基本用途,没有选项.

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 为一新行。 默认值将是 \n
  • prepend - 在文件名列表的每个条目中预留一些文字
  • append - 文件名列表中每个输入的附加文本
  • template - 函数需要一个参数(文件名),并在格式化后返回字符串。 可用于补充或代替, append 财务报告和审定财务报表 prepend
  • root - 根文件夹。 包括这个参数会返回相对路径列表,而不是绝对路径.

实例

鉴于文件结构 :

.
+-- 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

版本与发布记录

@fomantic/gulp-concat-filenames 共发布 3 个版本,首次发布于 2024/04/20;过去 12 个月发布了 1 个版本。

版本发布日期距今
3.0.0latest2026/07/183 个月前
2.0.02025/03/021.7 年前
1.2.12024/04/202 年前

关于 @fomantic/gulp-concat-filenames 的常见问题

@fomantic/gulp-concat-filenames 是什么?

类似于 concat,但创建一个文件,其中包含文件名列表,而非文件内容.

如何安装 @fomantic/gulp-concat-filenames?

在项目目录运行 npm install @fomantic/gulp-concat-filenames,或使用 pnpm add / yarn add / bun add。

@fomantic/gulp-concat-filenames 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@fomantic/gulp-concat-filenames 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@fomantic/gulp-concat-filenames 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@fomantic/gulp-concat-filenames 可以商用吗?

@fomantic/gulp-concat-filenames 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@fomantic/gulp-concat-filenames 的下载量有多少?

根据 npm 官方下载统计,@fomantic/gulp-concat-filenames 在 2026/10/15 – 2026/11/13 这 30 天内被下载 22,720 次,日均约 757 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fomantic/gulp-concat-filenames 还在维护吗?

最新版本 3.0.0 发布于 2026/07/18(3 个月前);至今共发布 3 个版本,其中过去 12 个月发布了 1 个;首次发布于 2024/04/20。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。