Home

Awesome

voila

best asset manager one can get in nodejs (at least we hope so)

Why does voila exist?

We needed an asset manager which meets the following condition:

Under the hood we use mincer which did the heavy lifting.

Voila is the brainchild of Pavan Kumar Sunkara

Installation

Go to you app root directory and run

npm install --save voila

Usage

In your connect/express application

var express = require('express')
  , voila = require('voila')
  , app = expres();

var conf = {
  development: {},
  production: {
    serve: "http://assets.yoursite.com/assets"
  }
}

app.use('/assets', voila(__dirname + '/../', conf[process.env.NODE_ENV])

That pretty much sets up the pipeline. Defaul directory structure is as follows

app
├─┬ assets
│ ├── css
│ ├── js
│ └── img
└─┬ public
  └── assets

In your package json add the following:

"scripts": {
  "assets": "rm -rf public/assets/* && voila -p http://assets.yoursite.com/assets"
}

This script should be activated before you publish to production, npm run-script assets. It creates the preprocessed files in /public/assets

License

MIT/X11

Bug Reports

Report here.