@fomantic/gulp-concat-filenames

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

Similar to concat, but creates a file with a list of filenames,not file contents.

原始使用文档
文档目录3 节
  1. Forked Version using updated dependencies
  2. Usage
  3. Basic Usage, No options.

Forked Version using updated dependencies

Original repo at https://github.com/the-simian/gulp-concat-filenames

Information

Packagegulp-concat-filenames
DescriptionSimilar to concat, but creates a list of names in the output file, rather than contents being merged.
Node Version>= 20

gulp-concat-filenames

Usage

Basic Usage, No options.

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);

###Arguments

Gulp concat-filenames takes 2 arguments: filename and options

####Filename [Required]

This first argument is the name of the output file the list of filenames will be put into.

#####Options [Optional]

The second argument is optional (pun intended), and is an object with the following properties:

  • newline - The character to use in place of \n for a newline. The default value will be \n
  • prepend - Some text to prepend to every entry in the list of filenames
  • append - Some text to append to every intry in the list of filenames
  • template - a function that takes one parameter (the file name) and returns the string after some formatting. Can be used in addition to, or instead of, append and prepend
  • root - the root folder. Including this argument will return a list of relative paths instead of absolute paths.

###Examples

Given the file structure:

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

running gulp file-manifest now produces a file called manifest.txt with the contents

==> one.txt <==
==> two.txt <==

Or you can use the template property, to format the output as well.


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);

running gulp file-manifest now produces a file called manifest.txt with the contents

XXX--ONE.TXT--YYY
XXX--TWO.TXT--YYY

###Contribution If you write tests, follow semver and have something to add, I love accepting pull requests!! Any questions? Make an issue on 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 是什么?

Similar to concat, but creates a file with a list of filenames,not file contents.

如何安装 @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 和提交记录判断。