In this recipe, we'll make use of the contrib-jst (0.6.0)
plugin and its amd
option to wrap our compiled blog template in an AMD module.
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.
The following steps take us through altering our configuration so that it wraps our compiled template in an AMD module.
First, we'll alter the configuration by adding the
amd
option to indicate that the compiled templates should be wrapped in an AMD module:jst: { blog: { options: { amd: true }, src: 'blog.html', dest: 'templates.js' } }
Using the
namespace
option, we can now also specify that we no longer want the compiled templates to be contained within theJST
namespace, since they will now be contained within their own module:jst: { blog: { options:...