Minimus
Asset bundler and deployer for node and S3.
Install
The project can be install with npm.
npm install minimus
Configuring
The minimus module should be laoded in your primary node app file (app.js, web.js, server.js, etc).
var minimus = ; var assets = ;
and then added as middleware in configure.
app;
Asset File
s3: # where css, js, and jst will be minified and deployed when ```minify: true``` bucket: baz key: foo secret: bar javascripts: modernizr: - public/javascripts/_vendor/modernizr.min.js common: # 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/* stylesheets: common: - public/stylesheets/_vendor/* - public/stylesheets/site.css
Wilcards
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
Using
In Express 3.x minimus is run as middleware adding the following to res.locals
:
stylesheetsjavascripts
These are included in views with a function call:
<%- stylesheets('sectionName') %>
where sectionName
is a section from the assets.yml file above.
Deploying
The following command will read the assets.yml file and deploy to the specified Amazon S3 bucket.
node_modules/minimus/bin/minimus
Setting the minify
option to true in the minimus function will use the specified S3 bucket for the assets.
Images
Images are not deployed as part of this process; they must be uploaded manually.
Express 2.x Sample
Minimus supports Express 2.x apps through helpers.
// inside app.configure minimus = ; ... //// helpers// app;