diff --git a/index.js b/index.js new file mode 100644 index 0000000..a1f6908 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +//this file is to export the module + + module.exports = require("./justgage.js"); diff --git a/justgage.js b/justgage.js index a9e2bda..5e82a9a 100644 --- a/justgage.js +++ b/justgage.js @@ -5,6 +5,7 @@ * @author Bojan Djuricic (@Toorshia) **/ + JustGage = function(config) { var obj = this; @@ -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; + } + diff --git a/package.json b/package.json index d3afe18..ee67cc0 100644 --- a/package.json +++ b/package.json @@ -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" }, @@ -30,5 +30,8 @@ "bugs": { "url": "https://github.com/toorshia/justgage/issues" }, + "dependencies": { + "raphael":"" + }, "homepage": "https://github.com/toorshia/justgage" }