Giter VIP home page Giter VIP logo

multibundle-mapper's Introduction

multibundle-mapper

Writable stream that accepts r.js config objects and writes mapping/bundling meta data into provided file of specified format (json, js, html).

Build Status

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);

Mapper ⏏

Kind: Exported class

new Mapper(format, filepath, options, callback)

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

mapper._toJson(callback)

Writes bundles data into JSON file

Kind: instance method of Mapper
Access: private
Params

  • callback function - invoked after file has been written

mapper._toJs(callback)

Writes bundles data into JS file

Kind: instance method of Mapper
Access: private
Params

  • callback function - invoked after file has been written

mapper._toHtml(callback)

Writes bundles data into HTML file

Kind: instance method of Mapper
Access: private
Params

  • callback function - invoked after file has been written

mapper._readAndWrite(file, callback)

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

mapper._getPrefixedBundle(file)string

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

mapper._write(bundle, encoding, next)

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

multibundle-mapper's People

Contributors

alexindigo avatar

Stargazers

Chris Wang avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.