create-blockly
create-blockly makes it easy to create Blockly instances in both node and the browser (using browserify).
In the browser, Blockly will always be installed in the most flexible and isolated way, using the Blockly's resizable iframe method.
Browser Example
First, make sure you have node
and npm
installed
on your machine.
Create a new directory with create-blockly installed:
mkdir MyProjectcd MyProjectnpm install create-blockly
Create "browser.js" that instantiates Blockly:
var createBlockly = ;var Blockly = ; // Whenever this Blockly editor changes, log the generated Javscript code.// More Blockly documentation at http://code.google.com/p/blockly/w/listBlockly;
Create the associated "browser.html" to load the Javascript:
<!-- This is where the iframed resizable Blockly will be embedded. --> <!-- This is the toolbox that defines which blocks are visible. --> <!-- http://code.google.com/p/blockly/wiki/Toolbox -->
Install helpers for the server:
npm install express enchilada
Create the "server.js" to serve the demo:
var express = ;var enchilada = ; var app = ;app;app;app;app;console
Run the server and open localhost:1337 in your browser:
$ node server.jsRunning demo on localhost:1337
Wishlist
- Allow checking out specific revisions of Blockly source from svn
- Allow user to specify their own copy of Blockly source
References
- Official Blockly wiki
Contributing
Just make a pull request :)