Optimize client javascript file with RequireJS and Almond

Sometimes the generated site doesn't load (after waiting 10 seconds or so I hard refresh to try again).
When it does work it can take a few seconds to load.

In production sites it's recommended to use the RequireJS optimizer with Almond to produce a file with all the dependencies embedded for best performance.

This is a proof of concept that produces the optimized build and changes the html to load it instead (when configured and successful).

What do you think?