thorax-rails 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,45 @@
1
+ /*global Handlebars: true */
2
+
3
+ var handlebars = require("./handlebars/base"),
4
+
5
+ // Each of these augment the Handlebars object. No need to setup here.
6
+ // (This is done to easily share code between commonjs and browse envs)
7
+ utils = require("./handlebars/utils"),
8
+ compiler = require("./handlebars/compiler"),
9
+ runtime = require("./handlebars/runtime");
10
+
11
+ var create = function() {
12
+ var hb = handlebars.create();
13
+
14
+ utils.attach(hb);
15
+ compiler.attach(hb);
16
+ runtime.attach(hb);
17
+
18
+ return hb;
19
+ };
20
+
21
+ var Handlebars = create();
22
+ Handlebars.create = create;
23
+
24
+ module.exports = Handlebars; // instantiate an instance
25
+
26
+ // Publish a Node.js require() handler for .handlebars and .hbs files
27
+ if (require.extensions) {
28
+ var extension = function(module, filename) {
29
+ var fs = require("fs");
30
+ var templateString = fs.readFileSync(filename, "utf8");
31
+ module.exports = Handlebars.compile(templateString);
32
+ };
33
+ require.extensions[".handlebars"] = extension;
34
+ require.extensions[".hbs"] = extension;
35
+ }
36
+
37
+ // BEGIN(BROWSER)
38
+
39
+ // END(BROWSER)
40
+
41
+ // USAGE:
42
+ // var handlebars = require('handlebars');
43
+
44
+ // var singleton = handlebars.Handlebars,
45
+ // local = handlebars.create();