Java Reference
In-Depth Information
Organizing Your Code
As you build more and more complex JavaScript projects, you'll find the amount of code
you are using increases into hundreds and then thousands of lines. This can be difficult to
manage without some sort of organizing. The first step is to break the code into separate
files, but this presents its own problems, such as how to include all the files on a web page
and which code to put in which files. Indeed, how do you ensure that a file has access to the
code in another file?
Just as real-life ninjas have lots of nifty weapons such as nunchakus and shuriken stars, there
are lots of cool tools that a JavaScript ninja can use to help organize code and make it run
more efficiently. In this chapter, we'll look at the various frameworks and tools that can be
employed to improve the quality of your code. In turn it will make it more organized and
easier to maintain, promoting reuse. We'll also look at how to make your applications ready
for production.
In this chapter, we'll cover the following topics:
• frameworks
• using modules
• MVC libraries such as Backbone.js, AngularJS, and CanJS
• template libraries such as Mustache, Jade, Underscore, Handlebars, EJS, and Hogan
• optimizing your code with minification
• build processes using Grunt and Gulp
• our project―create a build process, employ templates, and use MVC architecture
Search WWH ::

Custom Search