From 33920ad674126483414b8e879c57558352a382ed Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Fri, 13 Jul 2012 22:09:54 -0700 Subject: [PATCH] Add AMD module support --- Rakefile | 1 - mustache.js | 16 ++++++++++++++-- wrappers/requirejs/mustache.js.post | 3 --- wrappers/requirejs/mustache.js.pre | 6 ------ 4 files changed, 14 insertions(+), 12 deletions(-) delete mode 100644 wrappers/requirejs/mustache.js.post delete mode 100644 wrappers/requirejs/mustache.js.pre diff --git a/Rakefile b/Rakefile index a1c7920..bc32175 100644 --- a/Rakefile +++ b/Rakefile @@ -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" diff --git a/mustache.js b/mustache.js index f45009a..c6b6c6b 100644 --- a/mustache.js +++ b/mustache.js @@ -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; //