<commit_before>Bundle up!  [![Build Status](https://secure.travis-ci.org/FGRibreau/bundle-up.png)](https://secure.travis-ci.org/FGRibreau/bundle-up)
==========

Bundle up is a middleware for connect to manage all client-side assets in an organized way.

Fork by @FGRibreau
------------------
* Fix BundleUp(app, asset object | path string, options object);
* Added .addJsUrl() & .addCssUrl()
* Fix Express 2 & 3
* Bug fix when adding the same file in different bundles
* Added .addJsObject()

[Pound](https://github.com/FGRibreau/pound) the higher asset manager for Node.JS is now built over Bundle-up.

Installation
------------

    $ npm install bundle-up

Usage
-----

``` js
var BundleUp = require('bundle-up');
var assets = require('./assets');

BundleUp(app, assets, {
  staticRoot: __dirname + '/public/',
  staticUrlRoot:'/',
  bundle:true,
  minifyCss: true,
  minifyJs: true
});

// To actually serve the files a static file
// server needs to be added after Bundle Up
app.use(express.static(__dirname + '/public/'))
```

The first parameter to the BundleUp middleware is the app object and the second is the path to the assets file. Through the assets file all client-side assets needs to get added.

``` js
// assets.js
module.exports = function(assets) {
  assets.root = __dirname;
  assets.addJs('/public/js/jquery-1.6.4.min.js');
  assets.addJs('/public/js/jquery.placeholder.min.js');
  assets.addJs('/app/client/main.coffee');

  assets.addJsUrl('/socket.io.js');

  assets.addCss('/public/bootstrap/bootstrap.min.css');
  assets.addCss('/app/styles/screen.styl');

  assets.addCssUrl('http://twitter.github.com/bootstrap/assets/css/bootstrap.css');
}
```

Just point to a file (.js, .css, .coffee or .styl are currently supported) anywhere in your app directory. In your view you can then just render all the css or javascript files by calling `renderStyles` and `renderJs` like this:

``` jade
!!!
html
  head
    != renderStyles()
  body!= body
    != renderJs()
```

By default this will render

``` html
<link href='/bootstrap/bootstrap.min.css' media='screen' rel='stylesheet' type='text/css'/>
<link href='/min/app/styles/screen.css' media='screen' rel='stylesheet' type='text/css'/>

<script src='/js/jquery-1.6.4.min.js' type='text/javascript'></script>
<script src='/js/jquery.placeholder.min.js' type='text/javascript'></script>
<script src='/min/app/client/main.js' type='text/javascript'></script>
```

All assets will be compiled on-the-fly when `bundle:false` is set. Therefore the server never
needs to be restarted when editing the different assets.
<commit_msg>Readme fix<commit_after>Bundle up!  [![Build Status](https://secure.travis-ci.org/FGRibreau/bundle-up.png)](https://secure.travis-ci.org/FGRibreau/bundle-up)
==========

Bundle up is a middleware for connect to manage all client-side assets in an organized way.

Fork by @FGRibreau
------------------
* Fix BundleUp(app, asset object | path string, options object);
* Added .addJsUrl() & .addCssUrl()
* Fix Express 2 & 3
* Bug fix when adding the same file in different bundles
* Added .addJsObject()

[Pound](https://github.com/FGRibreau/pound) the higher asset manager for Node.JS is now built over Bundle-up.

Installation
------------

    $ npm install bundle-up

Usage
-----

``` js
var BundleUp = require('bundle-up')
,   assets = require('./assets');

BundleUp(app, assets, {
  staticRoot: __dirname + '/public/',
  staticUrlRoot:'/',
  bundle:true,
  minifyCss: true,
  minifyJs: true
});

// To actually serve the files a static file
// server needs to be added after Bundle Up
app.use(express.static(__dirname + '/public/'))
```

The first parameter to the BundleUp middleware is the app object and the second is the path to the assets file. Through the assets file all client-side assets needs to get added.

``` js
// assets.js
module.exports = function(assets) {
  // Support namespace/bundle
  assets.addJs('/public/js/jquery-1.6.4.min.js', 'default');
  assets.addJs('/public/js/jquery-1.6.4.min.js', 'app');

  assets.addJs('/public/js/jquery.placeholder.min.js');
  assets.addJs('/app/client/main.coffee');

  // New
  assets.addJsUrl('/socket.io.js');

  assets.addCss('/public/bootstrap/bootstrap.min.css');
  assets.addCss('/app/styles/screen.styl');

  // New
  assets.addCssUrl('http://twitter.github.com/bootstrap/assets/css/bootstrap.css');
}
```

Just point to a file (.js, .css, .coffee or .styl are currently supported) anywhere in your app directory. In your view you can then just render all the css or javascript files by calling `renderStyles` and `renderJs` like this:

``` jade
!!!
html
  head
    != renderStyles()
  body!= body
    != renderJs()
```

By default this will render

``` html
<link href='/bootstrap/bootstrap.min.css' media='screen' rel='stylesheet' type='text/css'/>
<link href='/min/app/styles/screen.css' media='screen' rel='stylesheet' type='text/css'/>

<script src='/js/jquery-1.6.4.min.js' type='text/javascript'></script>
<script src='/js/jquery.placeholder.min.js' type='text/javascript'></script>
<script src='/min/app/client/main.js' type='text/javascript'></script>
```

All assets will be compiled on-the-fly when `bundle:false` is set. Therefore the server never
needs to be restarted when editing the different assets.

{'fraction_non_alphanumeric': 0.16363636363636364, 'fraction_numerical': 0.0035984848484848487, 'mean_word_length': 3.912558139534884, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6356663', 'n_tokens_mistral': 1730, 'n_tokens_neox': 1672, 'n_words': 489}