Last active
November 24, 2015 15:43
-
-
Save nikcorg/6ad48cc1c3d84d98d384 to your computer and use it in GitHub Desktop.
Relates to http://stackoverflow.com/questions/33873368/how-to-require-additional-modules-in-node-js-app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>TableSort Demo</title> | |
<body> | |
<table> | |
<thead> | |
<tr> | |
<th class="default-sort">Weekday</th> | |
<th>Date</th> | |
</tr> | |
</thead> | |
<tbody> | |
<tr> | |
<td>Monday</td> | |
<td data-sort="11-23-2015">23.11.2015</td> | |
</tr> | |
<tr> | |
<td>Tuesday</td> | |
<td data-sort="11-24-2015">24.11.2015</td> | |
</tr> | |
<tr> | |
<td>Thursday</td> | |
<td data-sort="11-26-2015">26.11.2015</td> | |
</tr> | |
<tr> | |
<td>Friday</td> | |
<td data-sort="11-27-2015">27.11.2015</td> | |
</tr> | |
<tr> | |
<td>Wednesday</td> | |
<td data-sort="11-25-2015">25.11.2015</td> | |
</tr> | |
</tbody> | |
</table> | |
<script async defer src="./bundle.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Tablesort = require("tablesort"); | |
// Just the require needed, as the sort-method extends the Tablesort prototype | |
require("./sorts/tablesort.date.js"); | |
var table = document.querySelector("table"); | |
var sort = new Tablesort(table); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"build": "browserify index.js > bundle.js" | |
}, | |
"browserify-shim": { | |
"./sorts/tablesort.date.js": { | |
"depends": "tablesort:Tablesort" | |
} | |
}, | |
"browserify": { | |
"transform": ["browserify-shim"] | |
}, | |
"dependencies": { | |
"tablesort": "*", | |
"browserify": "*", | |
"browserify-shim": "*" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment