Skip to content

Commit

Permalink
Merge pull request #256 from martov1/master
Browse files Browse the repository at this point in the history
Made library commonJs friendly
  • Loading branch information
robertsLando authored Jul 30, 2019
2 parents 8c29fe9 + a1674e3 commit f1494ab
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//this file is to export the module

module.exports = require("./justgage.js");
10 changes: 10 additions & 0 deletions justgage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* @author Bojan Djuricic (@Toorshia)
**/


JustGage = function(config) {

var obj = this;
Expand Down Expand Up @@ -1181,3 +1182,12 @@ function extend(out) {

return out;
};

// am I in a commonJS environment? +
if(typeof exports === "object" && exports) {
// let's import raphael then
var Raphael = require('raphael');
// and i will export myself as a module.
module.exports = JustGage;
}

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "justgage",
"version": "1.2.2",
"description": "JustGage is a handy JavaScript plugin for generating and animating nice & clean gauges. It is based on Raphaël library for vector drawing, so it’s completely resolution independent and self-adjusting.",
"main": "justgage.js",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
Expand Down Expand Up @@ -30,5 +30,8 @@
"bugs": {
"url": "https://github.com/toorshia/justgage/issues"
},
"dependencies": {
"raphael":""
},
"homepage": "https://github.com/toorshia/justgage"
}

0 comments on commit f1494ab

Please sign in to comment.