Permalink
Browse files

Add AMD module support

  • Loading branch information...
1 parent 9079bd8 commit 33920ad674126483414b8e879c57558352a382ed @mjackson mjackson committed Jul 14, 2012
Showing with 14 additions and 12 deletions.
  1. +0 −1 Rakefile
  2. +14 −2 mustache.js
  3. +0 −3 wrappers/requirejs/mustache.js.post
  4. +0 −6 wrappers/requirejs/mustache.js.pre
View
@@ -65,5 +65,4 @@ templated_build "jQuery"
templated_build "MooTools"
templated_build "Dojo", :location => "dojox/string"
templated_build "YUI3", :location => "yui3/mustache"
-templated_build "RequireJS"
templated_build "qooxdoo"
View
@@ -2,9 +2,19 @@
* mustache.js - Logic-less {{mustache}} templates with JavaScript
* http://github.com/janl/mustache.js
*/
-var Mustache = (typeof module !== "undefined" && module.exports) || {};
+
+var Mustache;
(function (exports) {
+ if (typeof module !== "undefined") {
+ module.exports = exports; // CommonJS
+ } else if (typeof define === "function") {
+ define(exports); // AMD
+ } else {
+ Mustache = exports; // <script>
+ }
+}(function () {
+ var exports = {};
exports.name = "mustache.js";
exports.version = "0.5.1-dev";
@@ -598,4 +608,6 @@ var Mustache = (typeof module !== "undefined" && module.exports) || {};
return _renderer.render(template, view);
}
-})(Mustache);
+ return exports;
+
+}()));
@@ -1,3 +0,0 @@
-
-return Mustache;
-});
@@ -1,6 +0,0 @@
-/*
-Shameless port of a shameless port ^ 2
-@defunkt => @janl => @aq => @voodootikigod => @timruffles
-
-*/
-define(function(){

0 comments on commit 33920ad

Please sign in to comment.