Gulp Distributor
status: in alpha
Create multiple module distributions from your JavaScript source files.
You should clone this library to your local machine and run the default gulptask to see how the module works.
$ git clone https://github.com/michaelherndon/gulp-distributor.git
$ cd gulp-distributor
$ npm install
$ gulp
// src/// - array-copy-src.js// - base-class-src.js// - sub-class-src.js var gulp = distribute = runSequence = ; gulp; gulp; // will generate files in the following // lib/// - array-copy.js// - base-class.js// - sub-class.js // dist/amd/lib// - array-copy.js// - base-class.js// - sub-class.js // dist/browser/lib// - array-copy.js// - base-class.js// - sub-class.js
Options
dist
- src - a variable location for the distribution files. Defaults to "/dist" and replaces the $src var.
- amd - the location for the amd distribution files. Defaults to $src/amd/lib
- browser - the location for the browser distribution files. Defaults to $src/browser/lib
- commonjs - the location for the commonjs distribution files. Defaults to /lib
- es6 - (Not Implemented) the location for the es6 distribution files. Defaults to $src/es6/lib
templates
- src - a variable location for the template folder. Defaults to __dirname + "/templates" and replaces the $src var.
- amd - the location for the amd distribution files. Defaults to $src/amd.tpl
- browser - the location for the browser distribution files. Defaults to $src/browser.tpl
- commonjs - the location for the commonjs distribution files. Defaults to $src/lib.tpl
- es6 - (Not Implemented) the location for the es6 distribution files. Defaults to $src/es6.tpl
newLine
- default: "\n"
- amd: "\n\t"
- browser: "\n\t"
distro
Instructs which distributions that will be created. The available options are:
- all
- amd
- browser
- commonjs
- es6 (Not Implemented)
If you wish to remove an option, set the template option to false i.e.
return gulp ;
If you wish to add an option for a distro, add a template
return gulp ;
## namespace
This will instruct the browser distributions to append exports to a global namespace/ variable for source files.
## exports
An export variable that will be present in all files.
## templateEngine
Allows you to define the template engine that will create your module distributions.
The value must be a function that takes a content string and object for template variables.
{ return template; };
## files
Configures source files and dependencies.
// src// router-src.js// node_modules/ux-lexer return gulp ;
##### sample output for commonjs
var d0 = Lexer = d0Lexer Token = d0Token; var parser = ; // router code var { }; exportsRouter = Router; moduleexports = exports;
## license
The the license file that should be prepended to each distribution file.
## data
Default values that will be injected into the distribution templates.