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

Generating pages from a collection


In case we've got a collection of items in our site data, we might very well want to generate some pages using that collection. A site that displays blog posts, for instance, would probably want an individual page generated for each post in the collection of posts.

Getting started

In this recipe we'll be continuing work on the project from the Creating and using a site layout recipe in this chapter. Be sure to refer to it if you are not yet familiar with it's content. Before we start we should also make sure that the site builder and server are running. If they aren't yet running they can be started using the grunt server command.

How to do it...

The following steps take us through creating a data file that contains a collection of our blog posts, and configuring our project to generate pages using that collection.

  1. Let's start with creating the collection data that we'll be generating pages from. We can do this by creating a file called posts.yml in the src...