Mastering Web Application

(Rick Simeone) #1

Building and Testing


Third-party JavaScript libraries

AngularJS can be used alone as a single library to write fairly complex applications. At
the same time, it doesn't try to reinvent the wheel and reimplement popular libraries.


The sample application tries to keep dependencies on external, third parties' libraries
to the absolute minimum so we can focus on what AngularJS can do for us. Still,
many projects will use well-known libraries like jQuery, underscore.js and so on.
To demonstrate how AngularJS can coexist with other libraries the latest compatible
version of jQuery made it into the project.


Bootstrap CSS

AngularJS doesn't force or prescribe any particular CSS usage so anyone is free to style
their application as needed. To make our SCRUM application look pretty we will use
the popular Twitter Bootstrap (http://twitter.github.com/bootstrap/) CSS.


The sample application includes LESS templates of the Bootstrap's to illustrate how
LESS compilation can be included in the build chain.


Build system


There were times when JavaScript was used as a toy language, those days are long
over. In recent years, JavaScript has become a mainstream language. New, large and
complex applications are being written and deployed every day. Rising complexity
means more code being written. These days it is not uncommon to see projects
consisting of tens of thousands of lines of JavaScript code.


It is no longer practical to have one JavaScript file that can be simply included in an
HTML document; we need a build system. Our JavaScript and CSS files will undergo
many checks and transformations before being deployed on productions servers.
Some examples of those transformations include:



  • JavaScript source code must be checked for compliance with coding
    standards using tools like jslint (http://www.jslint.com/), jshint
    (http://www.jshint.com/) or similar.

  • Test suites should be executed as often as possible; at least as part of
    each and every build. As such testing tools and processes must be
    tightly integrated with the build system.

  • Some files might need to be generated (for example CSS files from
    templates like LESS).

  • Files need to be merged together and minified to optimize
    in-browser performance.

Free download pdf