Book Image

Grunt Cookbook

By : Jurie-Jan Botha
Book Image

Grunt Cookbook

By: Jurie-Jan Botha

Overview of this book

<p>A web application can quickly turn into a complex orchestration of many smaller components, each one requiring its own bit of maintenance. Grunt allows you to automate all the repetitive tasks required to get everything working together by using JavaScript, the most popular programming language.</p> <p>Grunt Cookbook offers a host of easy-to-follow recipes for automating repetitive tasks in your web application's development, management, and deployment processes. This book will introduce you to methods that can be used to automate basic processes and your favorite tools. By following the recipes, you will soon be comfortable using Grunt to perform a wide array of advanced tasks in a range of different scenarios.</p>
Table of Contents (17 chapters)
Grunt Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a plugin task


The functionality of Grunt plugins are mostly contained inside the tasks they provide. The plugin project scaffolding provided by the Yeoman tool creates one such task for us to work from or use as a reference when creating our own.

Getting started

In this recipe, we'll work with the basic project structure we created in the Setting up a basic plugin project recipe earlier in this chapter. Be sure to refer to it if you are not yet familiar with its contents.

This recipe also contains concepts that are introduced in the Creating a multi task, Using options in a task and Using files in a task recipes that can be found at the end of Chapter 8, Creating Custom Tasks. Be sure to refer to these recipes if you'd like to gain a deeper understanding of the concepts they introduced.

How to do it...

The following steps take us through creating a task that concatenates all the indicated source files, and then prepends a comment containing a timestamp and location to the result.

  1. We'll...