Simple gobble transformation that flattens all files in folders and subfolders with gobble
First, you need to have gobble installed - see the gobble readme for details. Then,
npm i -D gobble-flatten
gobblefile.js
var gobble = require( 'gobble' );
module.exports = gobble( 'someFolder' ).transform( 'flatten' );
Transforms:
|- file1.js
|- file2.js
|- folder1
|- file3.js
|- file4.js
|- folder2
|- file5.js
|- folder3
Into:
|- file1.js
|- file2.js
|- file3.js
|- file4.js
|- file5.js
Use gobble's built in include
and exlcude
to filter results:
gobble( 'someFolder' ).include( '**/*.html' ).transform( 'flatten' );
Duplicate file names currently handled on a last-wins basis.
Uses gobble-test example based testing. Run via:
npm test
Uses sander for recursive directory listing and promised-based file system access.
MIT. Copyright 2016 Marty Nelson