Permalink
Browse files

AMD support added to src files. Updated Gruntfile.

1 parent d6d5a10 commit 5e9388120b3f1b9e86e1c1bdb0818eb3a05a210a @jaridmargolin jaridmargolin committed Nov 13, 2013
Showing with 16 additions and 12 deletions.
  1. +6 −4 Gruntfile.js
  2. +2 −2 lib/formatter.js
  3. +1 −1 lib/formatter.min.js
  4. +5 −4 src/tmpls/intro.js
  5. +2 −1 src/tmpls/outro.js
View
@@ -34,10 +34,12 @@ module.exports = function(grunt) {
' * keycode handling\n' +
' */ \n\n',
process: function(src, filepath) {
- // Remove contents between Exclude Start and Exclude End
- src = src.replace( /\/\*\s*ExcludeStart\s*\*\/[\w\W]*?\/\*\s*ExcludeEnd\s*\*\//ig, '');
- // Rewrite module.exports to local var
- src = src.replace(/module.exports\s=/g, 'var');
+ if (!/tmpls\/.*\.js/.test(filepath)) {
+ // Remove contents between Exclude Start and Exclude End
+ src = src.replace( /\/\*\s*ExcludeStart\s*\*\/[\w\W]*?\/\*\s*ExcludeEnd\s*\*\//ig, '');
+ // Rewrite module.exports to local var
+ src = src.replace(/module.exports\s=/g, 'var');
+ }
// Return final
return src;
},
View
@@ -6,6 +6,7 @@
* thanks to digitalBush/jquery.maskedinput for some of the trickier
* keycode handling
*/
+
;(function (name, context, definition) {
if (typeof module !== 'undefined' && module.exports) { module.exports = definition(); }
else if (typeof define === 'function' && define.amd) { define(definition); }
@@ -619,7 +620,6 @@ utils.isSpecialKey = function (k) {
utils.isModifier = function (evt) {
return evt.ctrlKey || evt.altKey || evt.metaKey;
};
-
return Formatter;
-});
+});
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1,4 +1,5 @@
-;(function (window, document, undefined) {
-
-// Expose to window
-if (typeof window !== 'undefined') { window.Formatter = Formatter; }
+;(function (name, context, definition) {
+ if (typeof module !== 'undefined' && module.exports) { module.exports = definition(); }
+ else if (typeof define === 'function' && define.amd) { define(definition); }
+ else { context[name] = definition(); }
+})('Formatter', this, function () {
View
@@ -1,2 +1,3 @@
+return Formatter;
-})(window, document);
+});

0 comments on commit 5e93881

Please sign in to comment.