canvas-browserify
wrap canvas so you can load it the same in node or the client!
Example
draw a green circle in both the browser or node.
//example.jsvar Canvas =var dia = 200var canvas = dia diavar ctx = canvasvar context = canvas;var centerX = canvaswidth / 2;var centerY = canvasheight / 2;var radius = dia - 5/2;context;context;contextfillStyle = 'green';context;contextlineWidth = 5;contextstrokeStyle = '#003300';context;ifprocesstitle == 'browser'documentbodyelsecanvas
run it in node...
node example.js > circle.png
bundle and run in the browser
browserify example | indexhtmlify > index.html
open index.html
License
MIT