Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Getting Started with Grunt: The JavaScript Task Runner

You're reading from   Getting Started with Grunt: The JavaScript Task Runner If you know JavaScript you ought to know Grunt – the Task Runner for managing sophisticated web applications. From a basic understanding to constructing your own advanced Grunt tasks, this tutorial has it all covered.

Arrow left icon
Product type Paperback
Published in Feb 2014
Publisher
ISBN-13 9781783980628
Length 132 pages
Edition Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Jaime Pillora Jaime Pillora
Author Profile Icon Jaime Pillora
Jaime Pillora
Bocoup LLC Bocoup LLC
Author Profile Icon Bocoup LLC
Bocoup LLC
Arrow right icon
View More author details
Toc

Why use Grunt?


In the past five years, due to the evolution of Web browsers, focus has shifted from Desktop applications to Web applications. More companies are realizing that the web is a perfect platform to create tools to save people time and money by providing quick and easy access to their service. Whether it is ordering pizza or Internet banking, web applications are fast becoming the platform of choice for the modern business. These modern companies know that, if they were to build an application for a specific platform, like the iOS or Windows operating systems, they would be inherently restricting their audience, as each operating system has its own percentage of the total user base. They've realized that in order to reach everyone, they need a ubiquitous platform that exists in all operating systems. This platform is the Web. So, if everyone with Internet access has a browser, then by targeting the browser as our platform, our potential user base becomes everyone on the Internet.

The Google product line is a prime example of a business successfully utilizing the browser platform. This product line includes: Google Search, YouTube, Gmail, Google Drive, Google Docs, Google Calendar, and Google Maps. However, providing a rich user experience comes with a cost. These applications are tremendously more complex than a traditional website made with jQuery animated menus.

Complex JavaScript Web Applications require considerable design and planning. It is quite common for the client-side (or browser) JavaScript code to be more complicated than the server-side code. With this in mind, we need to ensure our code base is manageable and maintainable. The key to code manageability and maintainability is to logically structure our project and to keep our code DRY. Structuring includes the file and directory structure as well as the code structure (that is HTML, CSS, and JavaScript structure). Maintaining a logical directory structure provides predefined locations for all types of files. This allows us to always know where to put our code, which is very important for rapid development. DRY stands for Don't Repeat Yourself (http://gswg.io#dry). Hence, to keep your code DRY is to write code where there is little or no repetition and we embrace the idea of a "single source of truth". Similarly, we want to avoid repetition surrounding our build process. As we'll see throughout this book, Grunt is a great tool for achieving these goals.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime