Skip to content

Instantly share code, notes, and snippets.

@peol
Created September 19, 2012 13:00
Show Gist options
  • Save peol/3749513 to your computer and use it in GitHub Desktop.
Save peol/3749513 to your computer and use it in GitHub Desktop.
hbs-handlebars.patch
--- Handlebars.js Wed Sep 19 14:47:36 2012
+++ handlebars-1.0.rc.1.js Wed Sep 19 14:47:40 2012
@@ -1,3 +1,4 @@
+(function () {
// lib/handlebars/base.js
var Handlebars = {};
@@ -93,6 +94,7 @@
Handlebars.log(context);
});
;
+//>>excludeStart('excludeHbsParser', pragmas.excludeHbsParser)
// lib/handlebars/compiler/parser.js
/* Jison generated parser */
var handlebars = (function(){
@@ -480,25 +482,7 @@
parser.lexer = lexer;
return parser;
})();
-if (typeof require !== 'undefined' && typeof exports !== 'undefined') {
-exports.parser = handlebars;
-exports.parse = function () { return handlebars.parse.apply(handlebars, arguments); }
-exports.main = function commonjsMain(args) {
- if (!args[1])
- throw new Error('Usage: '+args[0]+' FILE');
- if (typeof process !== 'undefined') {
- var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), "utf8");
- } else {
- var cwd = require("file").path(require("file").cwd());
- var source = cwd.join(args[1]).read({charset: "utf-8"});
- }
- return exports.parser.parse(source);
-}
-if (typeof module !== 'undefined' && require.main === module) {
- exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args);
-}
-};
-;
+
// lib/handlebars/compiler/base.js
Handlebars.Parser = handlebars;
@@ -619,6 +603,7 @@
};
})();;
+//>>excludeEnd('excludeHbsParser')
// lib/handlebars/utils.js
Handlebars.Exception = function(message) {
var tmp = Error.prototype.constructor.apply(this, arguments);
@@ -1455,7 +1440,7 @@
}
})(Handlebars.Compiler, Handlebars.JavaScriptCompiler);
-
+//>>excludeStart('excludeHbsParser', pragmas.excludeHbsParser)
Handlebars.precompile = function(string, options) {
options = options || {};
@@ -1483,6 +1468,7 @@
return compiled.call(this, context, options);
};
};
+//>>excludeEnd('excludeHbsParser')
;
// lib/handlebars/runtime.js
Handlebars.VM = {
@@ -1547,4 +1533,11 @@
};
Handlebars.template = Handlebars.VM.template;
-;
+;
+
+// AMD Define
+define(function(){
+ return Handlebars;
+});
+
+})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment