code-dot-org/blockly — pull request #148 by brandonbloom (2013-10-09 19:01:14+00:00)
Title: EJS Templates & Loadable Levels

This is a big, scary, and long overdue pull request!

Let me first apologize for the messy commit history with various fixups and WIP commits. It would probably take me a few hours to clean this up without losing anything in all the merge madness. As a result, I'm going to beg your forgiveness for not rebasing cleanly.

This branch does two major things:

1) Eliminate's Google's soy templates
2) Enables maze & turtle levels to be loaded outside of the browser

The former is necessary(-ish) for the later but has the pleasant side effects of a smaller compiled output and much much faster build times. There's also no longer a build dependency on java or the closure libraries at all.

This now works:

```shell
node -e "console.log(JSON.stringify(require('./build/js/maze/levels')))"
node -e "console.log(JSON.stringify(require('./build/js/turtle/levels')))"
```

This is awesome because it means that we can compile levels separately (this PR doesn't do that yet) and can load and run aspects of the apps without the browser present. In the case of turtle, the levels actually execute solutions to produce the traced answers. That same power will be used to run all the puzzles & solutions in a test environment: again, without a browser & super duper fast. As we add more levels, the download will continue to grow and get harrier, but with separately loadable levels, we can remove them from the download all together! That means the server can just inject some JSON the same way it injects instructions overrides now, for example.

I have *very high confidence* that the levels data is correct despite these scary changes. Being able to output the level data as JSON means I am able to *diff* the levels. So any change to the templates & level construction code can have it's impact measured directly with my diff tool. These changes produce a diff that include one or two small string/loc fixes and some differences in whitespace in the resulting XML.

I don't have nearly as high confidence that I haven't broken something with respect to the page & feedback boxes. I've poked at them a bit, but I suspect that I've overlooked something. It should be *very fast* to fix any issues that come up.