- Directory walking to include all files you want
- CSS concatenation and compression with YUI
- On the fly CoffeeScript compilation
- On the fly Less CSS compilation
- Caching for production environments
The above code registers a satchel by the name of core, and includes jquery, underscore, backbone, and all js files in the lib sub-directory.
// enable dev mode // no caching, no compression Satchel.devmode = true // disable dev mode // compressed and cached Satchel.devmode = false
var index = JST["/index.jst"] // or a nested mustache template var other = JST["/subdirectory/other.mustache"]
val coffee = new Satchel( name = "coffee", root = "webapp/coffeescripts", mime = "coffee", patterns = List( "/**/*.coffee" ) )
Note: coffee-script.js must exist in your classpath, you can get it here: https://github.com/jashkenas/coffee-script/tree/master/extras
Simply add the servlet to your servlet container.
context.addServlet(new ServletHolder(new SatchelServlet()), "/bundles/*")
Now you can access your satchels via /bundles/core.js or /bundles/coffee.coffee