small medium large xlarge

Automate with Grunt: The Build Tool for JavaScript


Cover image for Automate with Grunt
Pages 84
Release P2.0 (2014-11-13)
ISBN 978-1-94122-211-9

Grunt is everywhere. JavaScript projects from jQuery to Twitter Bootstrap use Grunt to convert code, run tests, and produce distributions for production. It’s a build tool in the spirit of Make and Rake, but written with modern apps in mind. This book gets you up to speed with Grunt using practical hands-on examples, so you can wrangle your projects with ease. You’ll learn how to create and maintain tasks and project builds, and automate your workflow with plugins and custom tasks.

2014 Jolt Award Finalist!

In discussing this book, one of the Jolt Award judges lamented that there were not more inexpensive, single-topic, hands-on manuals that give you all you need to know in a direct and approachable style. This observation is spot on in this era of carelessly written manuals and defective documentation. However, Automate With Grunt is one of the few manuals that amply fulfills this simple mission. If you write apps primarily with JavaScript, this is the book to get and keep within reach.

—Andrew Binstock, editor in chief, Dr. Dobbs’ Journal

Choose Your Format(s)
  • $27.00 In Stock

    Save $1.00 on the combo pack.

  • $17.00 In Stock
  • $11.00 In Stock
  • Ebooks are DRM free.

  • Ebook delivery options.

About This Title

This BookBeginnerExpert

JavaScript has moved from being the language you love to hate to the language you need to use. And as JavaScript applications get more complex, you need a process to manage that complexity. While online tutorials just explain how to slap together a configuration file, this book goes further and shows you how to create your own tasks, design your own project templates, combine plugins together to bring a web app to life, and build your own plugins.

You’ll start by learning the basics of task creation, error handling, and logging as you create a simple configuration that executes basic JavaScript code using Node.js. Then you’ll jump right into file manipulation as you read, write, copy, and delete files. You’ll learn how Grunt’s powerful multitasks work as you build a task to concatenate files together. Once you’ve got a grasp on these basics, you’ll build a simple app with AngularJS and CoffeeScript, using Grunt to do all the heavy lifting and script processing. Finally, you’ll create your own plugin so you can understand how plugins work.

Each chapter contains hands-on exercises and ideas for further study. Whether you rock Ruby or sling C#, Grunt will be a useful addition to your toolbox.

Read the reviews .

You Might Also Like

  • Cover Image For Seven Web Frameworks in Seven Weeks…
  • Cover Image For Node.js the Right Way…
  • Cover Image For Async JavaScript…
  • Cover Image For Hands-on Backbone.js…
  • Cover Image For tmux…
  • Cover Image For Web Development with Clojure…
  • Cover Image For HTML5 and CSS3…

What You Need

This book covers Grunt 0.4.1 and higher, and requires basic knowledge of JavaScript and command-line tools on Windows, OS X, or Linux.


Each of our books has its own dedicated discussion area, where readers help each other out. Many authors also choose to drop by.

Join in…

Here are some recent topics:

Contents & Extracts

  • Acknowledgments
  • Preface
    • What’s in This Book
    • Who Should Read This Book
    • What You Need
    • Conventions
    • Where to Go for Help
  • The Very Basics excerpt
    • Installing Grunt and Configuring a Gruntfile
    • Our First Task
    • Handling Parameters
    • Throwing Errors
    • Chaining Tasks
    • Describing Tasks
    • What’s Next?
  • Manage Files
    • Creating the Project
    • Creating and Deleting Directories
    • Recursive File Copying
    • Using Values from Files
    • What’s Next?
  • One Task, Many Outputs
    • Introducing Multitasks
    • Multitasks and Files
    • What’s Next?
  • Build a Workflow
    • Creating the App
    • Wrangling the JavaScript
    • Adding Some Style
    • Simplifying the Build
    • Watching Files for Changes
    • Refreshing the Browser Automatically
    • What’s Next?
  • Create a Plug-in
    • The Structure of a Plug-in
    • Creating the Plug-in Skeleton
    • Building Our Plug-in’s Logic
    • Using JSHint to Check for Errors and Problems
    • What’s Next?
  • Create Project Scaffolds
    • Using Existing Templates
    • Creating a Custom Template
    • Including Files Conditionally
    • Including File Contents Conditionally
    • What’s Next?

Brought to You By

Brian P. Hogan is an author, editor, teacher, and web developer. When not hacking on Ruby or JavaScript code, he’s mentoring students, writing songs, watching “The Simpsons” and spending quality time with his wife and daughters.