O'Reilly logo

Grunt Cookbook by Jurie-Jan Botha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using data in a Jade template

Once we've got a Jade template, we can use it to render the same page structure with a variety of data. In this recipe, we'll make use of the contrib-jade (0.12.0) plugin in conjunction with the data option to send data that should be used in the rendering of the template.

Getting ready

In this example, we'll work with the basic project structure we created in the Rendering Jade templates recipe in this chapter. Be sure to refer to it if you are not yet familiar with its contents.

How to do it...

The following steps take us through providing data when rendering our template, and altering our index.jade template to make use of the provided data.

  1. First, we'll alter our index.jade template to make use of the variables provided ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required