Similar to partial templates in other template languages, Jade mixins are smaller template pieces that can accept parameters. Mixins are useful when generating common HTML chunks such as alert boxes, dialogs, and menus.
In this recipe we're going to compare Jade's mixins with the partial templates found in the other template languages by reimplementing the threaded conversation template. This is a recursive template that renders a threaded conversation tree.
We need to download
jade.min.js in our
recipe folder, available at https://github.com/visionmedia/jade.
Let's get started.
index.htmlwhich will contain the conversation placeholder, the main conversation template, and the recursive partial ...