gulp-cram
Assemble resources using cujoJS cram
Install
Install with npm
npm install --save-dev gulp-cram
Example
Tell cram.js to inspect the main page of an app that uses a static index.html file:
var gulp = ;var cram = ;var uglify = ; gulp;
Instruct cram.js to inspect the run.js file (the AMD configuration file) of a web app that does not use a static html file:
var gulp = ;var cram = ;var uglify = ; gulp;
Explicitly direct cram.js to create a bundle using options from a JSON file:
var gulp = ;var cram = ;var uglify = ; gulp;
API
cram(grokfile, options).into(output, readOptions)
grokfile
Type: String
Accepts a a string indicating an HTML or JavaScript file to auto-configure. It uses the same code inference algorithm as cram's command line HTML auto-configuration feature.
options
Type: Object
A JavaScript object like:
var options = // A string representing the path of the root of the application files. // This would typically point at the same directory as baseUrl in your AMD config. // This option is unnecessary if you specify a grok parameter that references an HTML file. appRoot: './src/app/' // An array of JSON-formatted files containing AMD configurations. // These configuration options will override any found by the grok option. configFiles: 'cramOverrides.json' 'productionOverrides.json' // An array of the ids of modules to include in the bundle. includes: 'analytics/flurry' // An array of the ids of modules to exclude from the bundle. excludes: 'app/settings' // A string indicating the location of an AMD loader script. // This script will be inserted at the very beginning of the output bundle. loader: './src/lib/curl/loader.js';
For more details, check out cram's CLI options.
output
Type: String
Accepts a string indicating path and name of the file to be streamed.
readOptions
Type: Object
A JavaScript object like:
var options = // A boolean that indicates if the result should be a buffer or a stream // Default value is 'true', so a buffer buffer: true
License
MIT © Brian Clozel