include support for browserify

This commit is contained in:
Brandon Aaron
2013-03-12 09:21:08 -05:00
parent 77551b1a94
commit 479b8310ff
9 changed files with 9536 additions and 5 deletions
+3 -1
View File
@@ -1,3 +1,5 @@
.DS_Store
/npm-debug.log
/build
/node_modules
/node_modules
/test/browserify/node_modules
+2 -2
View File
@@ -8,8 +8,8 @@ module.exports = function(grunt) {
preserveComments: 'some'
},
build: {
src: '<%= pkg.name %>.js',
dest: 'build/<%= pkg.name %>.min.js'
src: 'jquery.mousewheel.js',
dest: 'build/jquery.mousewheel.min.js'
}
},
jshint: {
+28 -1
View File
@@ -22,7 +22,34 @@ $('#my_elem').mousewheel(function(event, delta, deltaX, deltaY) {
```
## See it in action
[See the tests on Github](http://brandonaaron.github.com/jquery-mousewheel/test) or navigate to `test/index.html` in your browser.
[See the tests on Github](http://brandonaaron.github.com/jquery-mousewheel/test).
## Using with [Browserify](http://browserify.org)
Support for browserify is baked in.
```js
npm install jquery-mousewheel
npm install jquery-browserify
```
In your server-side node.js code:
```js
var express = require('express');
var app = express.createServer();
app.use(require('browserify')({
require : [ 'jquery-browserify', 'jquery-mousewheel' ]
}));
```
In your browser-side javascript:
```js
var $ = require('jquery-browserify');
require('jquery-mousewheel')($);
```
## License
+3
View File
@@ -14,6 +14,9 @@
if ( typeof define === 'function' && define.amd ) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS style for Browserify
module.exports = factory;
} else {
// Browser globals
factory(jQuery);
+19 -1
View File
@@ -1,6 +1,24 @@
{
"name" : "jquery.mousewheel",
"name" : "jquery-mousewheel",
"version": "3.1.1",
"description" : "A jQuery plugin that adds cross-browser mouse wheel support.",
"main" : "./jquery.mousewheel.js",
"repository" : {
"type" : "git",
"url" : "https://github.com/brandonaaron/jquery-mousewheel.git"
},
"keywords" : [ "jquery", "mouse", "wheel", "event", "mousewheel", "plugin", "browser" ],
"author" : {
"name" : "Brandon Aaron",
"email" : "brandon.aaron@gmail.com",
"url" : "http://brandonaaron.net/"
},
"licenses": [
{
"type": "MIT",
"url": "https://raw.github.com/brandonaaron/jquery-mousewheel/master/LICENSE.txt"
}
],
"devDependencies": {
"grunt-contrib-jshint": "~0.2.0",
"grunt-contrib-uglify": "~0.1.2",
+15
View File
@@ -0,0 +1,15 @@
# browserify test
First run
```js
npm install jquery-browserify
```
Then run
```js
browserify main.js > bundle.js
```
Then open index.html and console and scroll with the mousewheel. Should see the events being logged.
File diff suppressed because it is too large Load Diff
+4
View File
@@ -0,0 +1,4 @@
<script src="bundle.js"></script>
<script>
$(document).bind('mousewheel', function(e) { console.log(e); });
</script>
+2
View File
@@ -0,0 +1,2 @@
var $ = require('jquery-browserify');
require('../../jquery.mousewheel.js')($);