Dear internet.
I recently pushed a new version to npm – refactored into modern JavaScript (ES2015) with unit tests, linting and all the things that JavaScript hipsters were using last year!
- Dracula is just one npm install away:
npm install graphdracula npm install raphael
- Go on to fill up an index.js with such content:
var Graph = Dracula.Graph; var Renderer = Dracula.Renderer.Raphael; var Layout = Dracula.Layout.Spring; var graph = new Graph(); graph.addEdge('Banana', 'Apple'); graph.addEdge('Apple', 'Kiwi'); graph.addEdge('Apple', 'Dragonfruit'); graph.addEdge('Dragonfruit', 'Banana'); graph.addEdge('Kiwi', 'Banana'); var layout = new Layout(graph) var renderer = new Renderer('#paper', graph, 400, 300); renderer.draw()var Dracula = require('graphdracula');
- Compile:
browserify --debug index.js > bundle.js
- Serve it hot on an index.html:
<!DOCTYPE html>
<html>
<head>
<title>Graph Dracula Browserify Boilerplate</title>
<meta charset="utf-8">
</head>
<body>
<div id="paper"></div>
<script src="./bundle.js"></script>
</body>
</html>
It’s all on a brand new boilerplate at github.com/strathausen/dracula-browerify-boilerplate and it looks like this rawgit.com/strathausen/dracula-browerify-boilerplate/master/index.html.
I’ll put the new version of Dracula on a CDN some time soon and post the link at this very place. Stay tuned!