Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Introduction

5.1 brings some changes to the way our Javascript applications are built. Most of these changes involve the consolidation to RequireJS for loading and building. Other changes integrate RequireJS configuration information into the Karma unit testing framework.

Dojo Upgrade

Many of our thin-client applications are built using the Dojo framework. Prior to 5.1, the version of Dojo in use was based on 1.6. This presented several changes for us ranging from build-time, unit testing, the runtime production and debug loading in the browser. None of this was the fault of Dojo, but the fact that we mixed our Dojo usage with non-Dojo Javascript based on AMD modules, loaded and built by RequireJS.

In 5.1 we've upgraded to Dojo 1.9, which is fully AMD compatible. This allowed us to remove the Dojo build from our projects and consolidate to RequireJS Compressor for all Javascript building. On the browser-side we now have a single loading mechanism, RequireJS, instead of RequireJS and Dojo's loader. This move greatly simplifies the system as a whole.

The full Dojo 1.9 source is distributed as part of the common-ui plugin and made available through common-ui's RequireJS configuration for anyone to use.

RequireJS Optimizer Build

More commonly referred to as r.js, RequireJS Compressor is what we use to "build" our AMD-based Javascript applications. Building involves combining all necessary script files into a single file. Further optimizations can be made, condensing down the javascript to a single line with the shortest possible download size by enabling the UglifyJS option.

5.1 sees r.js updated to the latest version which enables more options for tuning the build. Subfloor-js has been enhanced to detect the availability of NodeJS and prefer it over the default Rhino-based build, which provides up to a 5x decrease in build time. Other enhancements to our build profiles have been made to further reduce the build time.

Karma Testing

Our Javascript unit tests going forward are all written as Jasmine tests run through Karmahttp://karma-runner.github.io/0.10/index.html. The full requireJS configuration is made available to any script running as part of the tests, greatly simplifying the task of writing unit tests.

TODO: link to Javascript development guide.
TODO: link to sample Javascript Platform Plugin

  • No labels