Categories
Uncategorized Update

Preview v1.0.1 on npm

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!

  1. Dracula is just one npm install away:
    npm install graphdracula
    npm install raphael
  2. Go on to fill up an index.js with such content:
    
    
    var Dracula = require('graphdracula');
    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()
  3. Compile:
    
    
    browserify --debug index.js > bundle.js
  4. 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!

By Johann Philipp

Computer science student.