diff --git a/README.md b/README.md index 71e1fc4..5f5fc6a 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,6 @@ Installation via Bower $ bower install jquery-stupid-table - Example Usage ------------- @@ -52,6 +51,14 @@ Add a `data-sort` attribute of "DATATYPE" to the th elements to make them sortab by that data type. If you don't want that column to be sortable, just omit the `data-sort` attribute. +Example Usage with Browserify/Webpack +------------------------------------- + +The JS: + + require('stupid-table-plugin'); + + $("table").stupidtable(); Predefined data types --------------------- diff --git a/stupidtable.js b/stupidtable.js index 8db085e..5f5a34e 100644 --- a/stupidtable.js +++ b/stupidtable.js @@ -1,6 +1,13 @@ // Stupid jQuery table plugin. -(function($) { +(function (factory) { + if(typeof module === 'object' && typeof module.exports === 'object') { + factory(require('jquery'), window, document); + } else { + factory(jQuery, window, document); + } +}(function($, window, document, undefined) { + $.fn.stupidtable = function(sortFns) { return this.each(function() { var $table = $(this); @@ -278,4 +285,4 @@ return th_index; }; -})(jQuery); +}));