Skip to content

Installation

Andrea Ferretti edited this page Jan 12, 2016 · 3 revisions

Bower and RequireJS

Paths.js is distributed with bower, so you can install it with

bower install paths-js

It is comprised of various AMD modules. If you use RequireJS, you can use a configuration such as

require.config({
  'paths': 'components/paths-js/dist/amd'
});

(the actual path will depend on your bower configuration). Then import the various modules like

var Pie = require(['paths/pie']);

Node.js

If you want to use it on the server, just do

npm install paths-js

to install it and then

var Pie = require('paths-js/pie');

This also works with Browserify.

Standalone script

If you want to use Paths.js in the browser, but you do not want to use AMD modules, there is the possibility to include it in the global object. To do this, just include the file dist/global/paths.js in a page, and then access the various APIs globally as Paths.Pie, Paths.Polygon and so on. Paths.js at version 0.3.1 weighs only 17.7kB minified and 6.1kB minified and gzipped, but of course if you choose the AMD version, you get to include exactly the modules you need.

Clone this wiki locally