UNPKG

3.09 kBMarkdownView Raw
1[![Build Status](https://travis-ci.org/the-simian/gulp-concat-filenames.svg?branch=master)](https://travis-ci.org/the-simian/gulp-concat-filenames) [![Coverage Status](https://coveralls.io/repos/the-simian/gulp-concat-filenames/badge.png?branch=coveralls)](https://coveralls.io/r/the-simian/gulp-concat-filenames?branch=coveralls) [![Code Climate](https://codeclimate.com/github/the-simian/gulp-concat-filenames/badges/gpa.svg)](https://codeclimate.com/github/the-simian/gulp-concat-filenames)
2[ ![Codeship Status for the-simian/gulp-concat-filenames](https://www.codeship.io/projects/b7aaf400-3b02-0132-083a-261a2707f8ca/status)](https://www.codeship.io/projects/42521)
3
4
5
6
7# Information
8
9| | |
10|--------------|---------------------------------------------------------------------------------------------------------------|
11| Package | gulp-concat-filenames |
12| Description | Similar to concat, but creates a list of names in the output file, rather than all the contents being merged. |
13| Node Version | >= 0.10 |
14
15## Usage
16
17
18### Basic Usage, No options.
19```js
20var concatFilenames = require('gulp-concat-filenames');
21
22var concatFilenamesOptions = {
23
24};
25
26function fileManifest(){
27 gulp
28 .src('./lib/**/*.*')
29 .pipe(concatFilenames('manifest.txt', concatFilenamesOptions))
30 .pipe(gulp.dest('./output/'));
31}
32
33
34gulp.task('file-manifest', fileManifest);
35
36```
37
38###Arguments
39
40Gulp concat-filenames takes 2 arguments: `filename` and `options`
41
42####Filename
43
44This first argment is the name of the output file the list fo filenames will be put into. This is required.
45
46#####Options
47
48The second argument is optional, and is an object with the following properties:
49
50- `newline` - The character to use in place of `\n` for a newline. The default value will be `\n`
51
52- `prepend` - Some text to prepend to every entry in the list of filenames
53
54- `append` - Some text to append to every intry in the list of filenames
55
56- `root` - the root folder. Including this argument will return a list of relative paths instead of absolute paths.
57
58
59Given the file structure:
60
61```
62.
63+-- somefile.txt
64+-- lib
65| +-- one.txt
66| +-- two.txt
67+-- gulpfile.js
68
69```
70
71
72
73```js
74var concatFilenames = require('gulp-concat-filenames');
75
76var concatFilenamesOptions = {
77 root: '/lib',
78 prepend: '==> ',
79 append: ' <=='
80};
81
82function fileManifest(){
83 gulp
84 .src('./lib/**/*.*')
85 .pipe(concatFilenames('manifest.txt', concatFilenamesOptions))
86 .pipe(gulp.dest('./output/'));
87}
88
89
90gulp.task('file-manifest', fileManifest);
91```
92
93running `gulp file-manifest` now produces a file called `manifest.txt` with the contents
94
95```
96==> one.txt <==
97==> two.txt <==
98
99```
100
101
102
103
104
105
106
107