Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Readme formatting

  • Loading branch information...
commit 6a2a24e416894aa5b5426d9c428f9e0aa1f107b6 1 parent 7676390
@dansimpson authored
Showing with 39 additions and 39 deletions.
  1. +39 −39 README.md
View
78 README.md
@@ -13,70 +13,70 @@ to develop javascript heavy web applications without worrying about css and java
##Javascript satchels
- val core = new Satchel(
- name = "core",
- root = "webapp/javascripts/vendor",
- patterns = List(
- "/jquery.js",
- "/underscore.js",
- "/backbone.js",
- "/lib/**/*.js"
+ val core = new Satchel(
+ name = "core",
+ root = "webapp/javascripts/vendor",
+ patterns = List(
+ "/jquery.js",
+ "/underscore.js",
+ "/backbone.js",
+ "/lib/**/*.js"
+ )
)
- )
-
- // yields combined and processed results
- core.processed
+
+ // yields combined and processed results
+ core.processed
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.
##Production/Development mode
- // enable dev mode
- // no caching, no compression
- Satchel.devmode = true
-
- // disable dev mode
- // compressed and cached
- Satchel.devmode = false
+ // enable dev mode
+ // no caching, no compression
+ Satchel.devmode = true
+
+ // disable dev mode
+ // compressed and cached
+ Satchel.devmode = false
##Javascript template satchels
- val templates = new Satchel(
- name = "templates",
- root = "webapp/javascripts/templates",
- mime = "jst",
- patterns = List(
- "/**/*.jst",
- "/**/*.mustache"
+ val templates = new Satchel(
+ name = "templates",
+ root = "webapp/javascripts/templates",
+ mime = "jst",
+ patterns = List(
+ "/**/*.jst",
+ "/**/*.mustache"
+ )
)
- )
The above will generate a wrapped JS object for each found template.
If for example, a file called index.jst existed in the root directory,
we would access the template in javascript via:
- var index = JST["/index.jst"]
-
- // or a nested mustache template
- var other = JST["/subdirectory/other.mustache"]
+ var index = JST["/index.jst"]
+
+ // or a nested mustache template
+ var other = JST["/subdirectory/other.mustache"]
##CoffeeScript satchels
- val coffee = new Satchel(
- name = "coffee",
- root = "webapp/coffeescripts",
- mime = "coffee",
- patterns = List(
- "/**/*.coffee"
+ 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
##Running with Scalatra
Simply add the servlet to your servlet container.
- context.addServlet(new ServletHolder(new SatchelServlet()), "/bundles/*")
+ context.addServlet(new ServletHolder(new SatchelServlet()), "/bundles/*")
Now you can access your satchels via /bundles/core.js or /bundles/coffee.coffee
Please sign in to comment.
Something went wrong with that request. Please try again.