Although not very common, 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 whitespace from templates, or if you'd like to remove or replace certain parts of a template you have no control over.
In this recipe, we'll make use of the contrib-jst (0.6.0)
plugin and the processContent
option provided by its jst
task to remove whitespace from our templates before compiling them.
In this example, we'll work with the basic project structure we created in the Compiling Underscore templates recipe of this chapter. Be sure to refer to it if you are not yet familiar with its contents.