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

Altering Jade templates before compilation

There might come a time that you would want to alter the contents of a template before compiling or rendering it. This is most commonly required when you would like to remove excessive white space from templates, or if you'd like to remove or replace parts of a template you have no control over.

In this recipe, we'll make use of the contrib-jade (0.12.0) plugin and the processContent option provided by its jade task to remove whitespace from our templates before rendering them to HTML.

Getting ready

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

How to do it... ...

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