From c51b26dbcc0f688e085cf89a42fe811095d55fb3 Mon Sep 17 00:00:00 2001 From: Quentin Roy Date: Fri, 20 Feb 2015 15:29:37 +0100 Subject: [PATCH] Add UMD support (following https://github.com/umdjs/umd & https://github.com/umdjs/umd/blob/master/jqueryPlugin.js). --- jquery.lettering.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/jquery.lettering.js b/jquery.lettering.js index 70aae46..e8a6c00 100644 --- a/jquery.lettering.js +++ b/jquery.lettering.js @@ -10,7 +10,18 @@ * * Date: Mon Sep 20 17:14:00 2010 -0600 */ -(function($){ +(function (factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['jquery'], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS + module.exports = factory(require('jquery')); + } else { + // Browser globals + factory(jQuery); + } +}(function($){ function injector(t, splitter, klass, after) { var text = t.text() , a = text.split(splitter) @@ -69,4 +80,4 @@ return this; }; -})(jQuery); +}));