ariatemplates/hashspace — pull request #219 by b-laporte (2014-06-27 21:05:54+00:00)
Title: support of global compilation mode on top of commonJS

This small PR introduces a new compilation option called `mode` that allows to choose between `"commonJS"` and `"global"`:

```
// default mode is "commonJS"
// default globalRef is "hsp" (only used when mode is "global")
var r = compiler.compile(sample.template, "template1", {mode:"global", globalRef:"foo"});
```
In practice this change cannot be used yet as we have to package and distribute the hashspace runtime as a global variable first (e.g. on ariatempaltes CDN). But when this is done, I would be in favour of putting `"global"` as default compilation mode (of course hashspace *Getting Started* should be updated accordingly)

Note: I chose to have an enum type for mode as I guess we will want to support `"es6"` as a new mode soon, so a basic *boolean* was not enough...