gobble-concat-order
Concatenate files in gobble, with an explicit file order.
Installation
I assume you already know the basics of Gobble.
npm i -D gobble-concat-order
Usage
Just as gobble-concat, but with three new options.
gobblefile.js example:
var gobble = require( 'gobble' );
module.exports = gobble( 'js' ).transform( 'concat-order', {
dest: 'bundle.js',
before: ['someUtility.js', 'someFramework/*.js', 'myConstants.js'],
after: ['finalize.js', 'wrap.js'],
match: {}
});
In this example, the javascript files will be concatenated in the following order: someUtility
, files in the someFramework
directory, myConstants
, everything else, finalize
and then wrap
.
before
and after
option
An array of minimatch expressions. These can be plain strings, strings with wildcards, or RegExps.
match
option
A set of minimatch options that will be applied to all items in the before
and after
arrays.
Caveats
- The
sort
option in gobble-concat is superseded in this gobble-concat-order. Supplying it will have no effect. - If a file matches more than one expression in either the
before
orafter
lists, their position will be that of the first match. - If more than one file match the same expression, they will be sorted alphabetically.
License
"THE BEER-WARE LICENSE":
<ivan@sanchezortega.es> wrote this file. As long as you retain this notice you
can do whatever you want with this stuff. If we meet some day, and you think
this stuff is worth it, you can buy me a beer in return.