Skip to content

Commit

Permalink
Add support for CommonJS/AMD/UMD. Release 1.3.5.
Browse files Browse the repository at this point in the history
  • Loading branch information
szimek committed Mar 1, 2015
1 parent 885a0d0 commit 1fb11f1
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 10 deletions.
22 changes: 22 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,26 @@ module.exports = function(grunt) {
}
},

umd: {
options: {
objectToExport: 'SignaturePad',
globalAlias: 'SignaturePad',
indent: 4
},
dev: {
options: {
src: 'signature_pad.js',
dest: 'signature_pad.js'
}
},
dist: {
options: {
src: 'signature_pad.min.js',
dest: 'signature_pad.min.js'
}
}
},

uglify: {
dist: {
options: {
Expand Down Expand Up @@ -81,11 +101,13 @@ module.exports = function(grunt) {
});

grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-umd');
grunt.loadNpmTasks('grunt-contrib-uglify');

grunt.registerTask('default', [
'jshint',
'banner',
'umd',
'uglify'
]);
};
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ file_put_contents( "signature.png",$decoded_image);
```

## Changelog
### 1.3.5
* Add support for CommonJS/AMD/UMD.

### 1.3.4
* Really fix `fromDataURL` on HiDPI screens.

Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "signature_pad",
"description": "Library for drawing smooth signatures.",
"version": "1.3.4",
"version": "1.3.5",
"homepage": "https://github.com/szimek/signature_pad",
"author": {
"name": "Szymon Nowak",
Expand All @@ -17,8 +17,9 @@
"type": "MIT"
}],
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-jshint": "~0.7.2",
"grunt-contrib-uglify": "~0.2.7"
"grunt": "~0.4.5",
"grunt-contrib-jshint": "~0.11.0",
"grunt-contrib-uglify": "~0.8.0",
"grunt-umd": "~2.3.2"
}
}
24 changes: 22 additions & 2 deletions signature_pad.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module unless amdModuleId is set
define([], function () {
return (root['SignaturePad'] = factory());
});
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory();
} else {
root['SignaturePad'] = factory();
}
}(this, function () {

/*!
* Signature Pad v1.3.4
* Signature Pad v1.3.5
* https://github.com/szimek/signature_pad
*
* Copyright 2014 Szymon Nowak
* Copyright 2015 Szymon Nowak
* Released under the MIT license
*
* The main idea and some parts of the code (e.g. drawing variable width Bézier curve) are taken from:
Expand Down Expand Up @@ -341,3 +357,7 @@ var SignaturePad = (function (document) {

return SignaturePad;
})(document);

return SignaturePad;

}));
8 changes: 4 additions & 4 deletions signature_pad.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1fb11f1

Please sign in to comment.