Writable stream that accepts r.js config objects and writes mapping/bundling meta data into provided file of specified format (json, js, html).
Example
var multibundle = require('multibundle')
, Mapper = require('multibundle-mapper')
, options = require('./options/bundles.js')
, config = require('./options/config.js')
;
// optimize
var bundler = multibundle(config, options);
var bundleMapper = Mapper.json('config/local.json', {prefix: config.prefix});
bundler.pipe(bundleMapper);
Kind: Exported class
Creates writable stream attached to the provided endpoint (file) of the specified format.
Params
-
format
string
- output file format -
filepath
string
- path to the output file -
options
object
- list of options to adjust Mapper's behavior -
callback
function
- invoked after all data has been written
Writes bundles data into JSON file
Kind: instance method of Mapper
Access: private
Params
-
callback
function
- invoked after file has been written
Writes bundles data into JS file
Kind: instance method of Mapper
Access: private
Params
-
callback
function
- invoked after file has been written
Writes bundles data into HTML file
Kind: instance method of Mapper
Access: private
Params
-
callback
function
- invoked after file has been written
Checks if file exists and reads from it, otherwise passes empty content and writeFile function bound to the file
Kind: instance method of Mapper
Access: private
Params
-
file
string
- file path to read -
callback
function
- invoked with file's content (or empty string) and write function
Composes prefixed file path for provided bundle local file
Kind: instance method of Mapper
Returns: string
- prefix file name sans extension
Access: private
Params
-
file
string
- bundle's file name
Receiver for the written data (underlying writeable stream interface)
Kind: instance method of Mapper
Access: private
Params
-
bundle
object
- bundle metadata -
encoding
string
- encoding type for a chunk, ignored since expecting only objects -
next
function
- callback function