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 and using a site layout


Having a consistent layout across a site can drastically improve its usability and also save time in its development. The Assemble framework allows us to easily create and use layouts in various ways.

Getting ready

In this recipe we'll continue working on the project from the Adding data to the site recipe in this chapter. Be sure to refer to it if you are not yet familiar with it's contents. 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 new layout template and setting up some sample blog pages that use it.

  1. First, we'll create a new layout template that will provide the layout for our sample blog post pages. Let's create a file called post.hbs in the src/templates/layouts directory and fill it with the following contents:

    ---
    layout: src/templates/layouts/default.hbs
    ---
    <div class...