The gulp plugin which output filenames.
This gulp plugins discover the files in the given path, and output them in the way you define.
npm install gulp-output --save-dev
var output = require('gulp-output');
gulp.src( 'httpdocs/libs/**/*.js' )
.pipe( output({
destination: 'template/libs.html',
root:__dirname+'/httpdocs/'
}) );
You also have the possibility to provile multiple path at one:
var output = require('gulp-output');
gulp.src( ['httpdocs/libs/**/*.js', 'httpdocs/otherlibs/*.js'] )
.pipe( output({
destination: 'template/libs.html',
root:__dirname+'/httpdocs/'
}) );
<stream> output(<options>);
destination String
Where to output the result of the process
formator Function
This function will be called for each file found in the stream. The default formator will output the path of each file on a separate line. If you want to provide a custom output, define your own formator. The function will be called with the following parameters:
- path
String
Path to the file - filename
String
Filename - extension
String
Extension of the file
Example to ouput for jade
function jadeFormator( path, filename, extension )
{
return 'script(src="'+path+'")\n';
}
root String
All the retrieved file will have the full os path, this is often not convenient. By defining the root parameter, this root will be removed automatically from all the path. By default the root is equal to the directory of the gulpfile.js
.