Pop Tags


A Pop Tag created by an extension will be called with 3 parameters when rendered by a template:

  1. options - contains the attributes that get passed to the tag in the template. 
  2. enclosed - represents the part of the template that’s inside the tag.
  3. scope - contains the current variable(s) within the scope of the template where the tag is called.

The options parameter is useful for passing in specific information to an extension. Here’s a small extension that will say hello to someone:


exports.greet = function(options) {
  return "Hello, " + + "!";

And a template using it:

<h1><pop:hello:greet name="Mathias" /></h1>

This would give the output <h1>Hello, Mathias!</h1>.

Continue to Enclosed »