Skip to content

Significantly refactor javascript and add js build tool #1

Merged
merged 7 commits into from Apr 25, 2012

2 participants

@johnkpaul
Collaborator

Ben and Gustavo, this is a really large refactor of the front end. Feel free to throw any of this out if you feel like it's the wrong way to go.

Here's what I did:

  1. Added the grunt javascript build tool. It's basically ant for javascript. You can install it with npm install -g grunt
  2. Enabled the grunt default linter, jshint, and configured the qunit test runner. These can be run with grunt lint or grunt qunit respectively. In order to run the tests from the command line, you will need to install phantomjs, the headless webkit browser. If you want to run them from the qunit html file, you can just open test/main/javascript/index.html
  3. Added a qunit test example file
  4. Moved JSON2 out of the main logger source code. This is concatenated to logger.js and written to the dist directory when you run grunt min.
  5. Added the microajax js library to the min build target and removed the handrolled version.

With these changes, we're at 1.6k minified with uglifyjs and gzipped. I don't know if you two have a goal as to the final filesize or browser support, but most of that is JSON2. Without JSON2, it's 442 bytes gzipped. Even if we don't give up <IE8 support, we could handroll our own JSON.stringify. JSON2 handles every possible edge case and has features that we probably don't need.

@gmedina gmedina was assigned Apr 19, 2012
@johnkpaul johnkpaul merged commit 041473b into benburton:master Apr 25, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.