1 | # gulp-print
|
2 |
|
3 | [](https://npmjs.org/package/gulp-print)
|
4 | [](https://gittip.com/alexgorbatchev)
|
5 | [](https://david-dm.org/alexgorbatchev/gulp-print)
|
6 | [](https://david-dm.org/alexgorbatchev/gulp-print#info=devDependencies)
|
7 | [](https://travis-ci.org/alexgorbatchev/gulp-print)
|
8 |
|
9 | This is a very basic [gulp](http://gulpjs.com) plugin that prints names of files. It's useful as a debugging tool to see which files are moving through the pipe or as a status printout.
|
10 |
|
11 | ## Installation
|
12 |
|
13 | ```sh
|
14 | npm install gulp-print
|
15 | ```
|
16 |
|
17 | ## Usage Example
|
18 |
|
19 | ```js
|
20 | // CommonJS
|
21 | const gulp = require('gulp');
|
22 | const print = require('gulp-print').default;
|
23 |
|
24 | // ... or ES modules
|
25 | import * as gulp from 'gulp';
|
26 | import print from 'gulp-print';
|
27 |
|
28 | gulp.task('print', () => {
|
29 | gulp.src('test/*.js')
|
30 | .pipe(print())
|
31 | });
|
32 |
|
33 | // ... or using custom formatter:
|
34 |
|
35 | gulp.task('print', () => {
|
36 | gulp.src('test/*.js')
|
37 | .pipe(print(filepath => `built: ${filepath}`))
|
38 | });
|
39 |
|
40 | // ... change log function
|
41 | import { setLogFunction } from 'gulp-print';
|
42 |
|
43 | setLogFunction(message => console.log('LOG', message));
|
44 | ```
|
45 |
|
46 | ## API
|
47 |
|
48 | ### print(formatter)
|
49 |
|
50 | * `formatter` is a callback format function that passes in filepath to be printed. Callback should return a string which will be printed.
|
51 |
|
52 | ## Testing
|
53 |
|
54 | ```sh
|
55 | npm test
|
56 | ```
|
57 |
|
58 | ## License
|
59 |
|
60 | The MIT License (MIT)
|
61 |
|
62 | Copyright 2014 Alex Gorbatchev
|
63 |
|
64 | Permission is hereby granted, free of charge, to any person obtaining a copy
|
65 | of this software and associated documentation files (the "Software"), to deal
|
66 | in the Software without restriction, including without limitation the rights
|
67 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
68 | copies of the Software, and to permit persons to whom the Software is
|
69 | furnished to do so, subject to the following conditions:
|
70 |
|
71 | The above copyright notice and this permission notice shall be included in
|
72 | all copies or substantial portions of the Software.
|
73 |
|
74 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
75 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
76 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
77 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
78 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
79 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
80 | THE SOFTWARE.
|