0.1.1 • Published 11 years ago

multiple-builds v0.1.1

Weekly downloads
11
License
-
Repository
github
Last release
11 years ago

Multiple-builds

Adds the Abbility to generate multiple outputs for the component builder.

When you build a large application, most of the time you have a website to show off your product and then the application itself. The majority of your code obviously belongs to your core application because thats where most of the interaction happens. So it makes sense to have two build files corresponding to those almost completely different pages. Component's builder doesn't have that feature implemented.

Installation

$ npm install multiple-builds

Usage

Add a build property to your component.json file for each major component from which you want to have a seperate build

{
  ...
  "build": "site"
  ...
}

In your normal build process you can now build those major components with their dependencies

build/builder.js

var Builder = require('component-builder'),
    multiple = require('multiple-builds'),
    templates = require('./templates'),
    styles = require('./styles')

module.exports = function( req, res, next ) {
  new Builder('.')
    .use( templates )
    .use( styles )
    .use( multiple )
    .build( 'site', 'public/site' )
    .build( 'account', 'public/account' )

  next()
}

This will output two independent builds:

- public
- - site.js
- - site.css
- - account.js
- - account.css

API

.build( name:String, path:String )

name must be identical to the build property in your component.json