Asset bundler for express.js apps with S3 deployment option


Asset bundler and deployer for node and S3.

The project can be install with npm.

npm install minimus

The minimus module should be laoded in your primary node app file (app.js, web.js, server.js, etc).

var minimus = require('minimus');
var assets = minimus({
    assetsFile:     __dirname + '/config/assets.yml',   // path to asset file (below) 
    minify:         false                               // pass in boolean based on NODE_ENV 

and then added as middleware in configure.

app.configure(function () {
s3:             # where css, js, and jst will be minified and deployed when ```minify: true```
    bucket: baz
    key: foo
    secret: bar
        - public/javascripts/_vendor/modernizr.min.js
        # core
        - public/javascripts/_vendor/plugins.js
        - public/javascripts/_vendor/bootstrap-min.js
        # views
        - public/javascripts/views/foos/super-special-view.js
        - public/javascripts/views/foos/*
        - public/javascripts/views/bars/*
        # templates
        - public/templates/foos/*
        - public/templates/bars/*
        - public/stylesheets/_vendor/*
        - public/stylesheets/site.css

Please note only one level of wildcard mapping is supported.

- public/javascripts/views/foos/*       # will match all files in the foos dir

Will not work:

- public/javascripts/views/*            # will match all files in the views dir, not in the child dirs below

In Express 3.x minimus is run as middleware adding the following to res.locals:


These are included in views with a function call:

<%- stylesheets('sectionName') %>

where sectionName is a section from the assets.yml file above.

The following command will read the assets.yml file and deploy to the specified Amazon S3 bucket.


Setting the minify option to true in the minimus function will use the specified S3 bucket for the assets.

Images are not deployed as part of this process; they must be uploaded manually.

Minimus supports Express 2.x apps through helpers.

// inside app.configure 
minimus = minimus({
    express3: false,
    useMinified: false,
    yamlFilePath: __dirname + '/config/assets.yml'
// helpers 
app.dynamicHelpers ({
    javascriptsfunction (reqres) {
        return function (name) {
            return minimus.javascripts(name);
    stylesheetsfunction (reqres) {
        return function (name) {
            return minimus.stylesheets(name);