IntelLabs / RiverTrail

An API for data parallelism in JavaScript
Other
748 stars 71 forks source link

Combine user-side JS includes into a single minified include #41

Closed lkuper closed 9 years ago

lkuper commented 10 years ago

People using River Trail should only have to include a single script that concatenates all the existing ones, ideally minified.

lkuper commented 9 years ago

As part of addressing this bug, we should also update our existing examples, the tutorial, and everything else we've got to import the single minified script.

lkuper commented 9 years ago

Still on my todo list, although @jsreeram, feel free to take it if you have time.

All the JS minification tools I've found either require Node or Java. My current best idea for how to do this is to use Grunt (a Node package) to concatenate and then minify the files.

jsreeram commented 9 years ago

I have added a single include file dist/RiverTrail.js and have updated the examples. On my local copy, I have a pre-commit hook that does this concat'ting. Perhaps this is the simplest solution ? If not, we can use Grunt. No minification/uglification as yet - I haven't added the source map and we want to keep it debuggable in the meanwhile.

lkuper commented 9 years ago

I got concat/minify set up with Grunt, and I'd like to close this issue, but first we need to update the interactive shell and Tour de Block to use the single include. I thought this would be straightforward, but it caused errors on the interactive shell. And if I change the order of concatenation to match the old order of includes, then we get an error caused by "use strict" in one of the earlier files leaking into a later file.

Probably the right way to fix this is to clean up the code to follow strict mode as much as possible, but if that's not possible then we need to use "use strict" within function scope only. I'll work on this.

jsreeram commented 9 years ago

This appeared to be a bug in combine which I have pushed a patch for. On my setup, with the latest RiverTrail.js copied over, this make the interactive shell work for me.

lkuper commented 9 years ago

@jsreeram Great! Thanks, it works for me now too. I just updated the submodules for RiverTrail-interactive and RiverTrail-TourDeBlock, and also updated the tutorial and test page in this repo to use the single include. I don't think there are any more places that don't use the single include now, so I'm closing this.