Mastering Grunt Master this powerful build automation tool to streamline your application development Daniel Li BIRMINGHAM - MUMBAI Mastering Grunt Copyright 2014 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information. First published: April 2014 Production Reference: 1180414 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78398-092-5 www.packtpub.com Cover Image by Michael Harms (kunstraum@googlemail.com) Credits AuthorProject Coordinator Daniel Li Harshal Ved ReviewersProofreaders Maria Gould Florian Bruniaux Bernadette Watkins Philippe Charrire Peter deHaan IndexerCommissioning Editor Monica Ajmera Mehta Kartikey Pandey Graphics Ronak Dhruv Acquisition Editor Richard Harvey Production Coordinators Pooja Chiplunkar Content Development Editor Manu Joseph Anila Vincent Technical EditorsCover Work Pooja Chiplunkar Manan Badani Indrajit Das Copy Editors Mradula Hegde Gladson Monteiro Deepa Nambiar Kirti Pai Alfida Paiva About the Author Daniel Li is currently an independent consultant for small- and medium-sized businesses, and resides in Waterloo, Ontario. Having gained experience at over a dozen institutions since 2009, he leverages his knowledge of Grunt.js and modern web development in writing this book. He has won over $20,000 in coding competitions since 2009, and most recently won the Kik Cup Hackathon in Fall 2013.
His open source contributions over the last three years helped him earn a place as a finalist in Canada's Top 20 Under 20 2013 list. He occasionally answers questions on the collaborative question and answer website, stackoverflow.com, as a top 4 percent user. He has also authored Instant Brainshark, Packt Publishing. I would like to dedicate this book to all those who believed in me. About the Reviewers Florian Bruniaux is a French student at the University of Technology of Troyes (UTT), and is studying in the IT and Information Systems department. He is passionate about new technologies, particularly of process optimization and software development.
Specialized in frontend and client-side development, he has worked for various companies such as Aylan, a French start-up, Oxylane, and EDF, where he worked on IT projects such as the server-monitoring system, cross-browser, multidevice app conception, and development. I would like to thank Steve Burghgraeve, an IT engineer at Oxylane, and Aurlien Bnel, a teacher, researcher, and lecturer in Computer Science at UTT, for their help in my different projects and all the knowledge they've transferred to me. Philippe Charrire is a bid manager at Steria in France, and at night, he is an open source developer advocate for the Golo project (http://golo-lang.org/) and is a Backbone enthusiast. He has written a small French open source book about Backbone.js (https://github.com/k33g/backbone.en.douceur/). He is also an occasional speaker on Backbone.js and mobile technologies. Peter deHaan likes Grunt a lot and thinks that it's the best thing to happen to Node.js since npm. Peter deHaan likes Grunt a lot and thinks that it's the best thing to happen to Node.js since npm.
You can follow his Grunt npm-Twitter-bot feed using the handle @gruntweekly. www.PacktPub.com Support files, eBooks, discount offers,and more You might want to visit www.PacktPub.com for support files and downloads related to your book. Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub. com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
TM http://PacktLib.PacktPub.com Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read, and search across Packt's entire library of books. Why subscribe? Fully searchable across every book published by Packt Copy and paste, print, and bookmark content On demand and accessible via web browser Free access for Packt account holders If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access. Table of Contents Table of Contents[ ii ]Table of Contents[ iii ] Preface Grunt.js is primarily used for DevOps integration. Being able to automate compression, conversion, and obfuscation, developers and sysadmins are able to deploy projects in a fast and easy way.
Previous solutions have required too much knowledge. With the ease of using Grunt plugins and configuration files, it allows developers to work along with sysadmins throughout the integration process. What this book coversChapter 1, Getting Started, gives a brief introduction to Grunt.js for readers. It will introduce the basic concepts required to understand how Grunt.js works and why automated integration is important. The project in this chapter will set up users with all the tools required for the upcoming projects from this point forward. Chapter 2, Developing a Blog with Jade and Sass, will look into Jade, a templating engine originally developed for the Node.js platform. Chapter 2, Developing a Blog with Jade and Sass, will look into Jade, a templating engine originally developed for the Node.js platform.
It will involve developing a blog as a use case, using templates for individual posts and the blog as a whole. The project will also emphasize the importance of compression, minification, and obfuscation in developing a high-traffic blog as a use case. Chapter 3, Making an Employee Management System, will look into CoffeeScript, a language that compiles to JavaScript. It will involve developing an employee management system as a use case, demonstrating CoffeeScript's easy-to-use classes and coding practices. Chapter 4, Final Project Simple Bulletin Board System, will be the largest project in the book. It will involve creating a simple BBS website, also known as a message board or forum, using all the concepts involved in this book.
We will illustrate the importance of using test-driven development via Mocha throughout this chapter. PrefaceChapter 5, Best Practices for Modern Web Applications, will cover the best practices that are used today for frontend development. It will cover, search engine optimization, form validation, user experience/interface design, and responsive design.
Next page