PostHTML configuration

Maizzle uses PostHTML as its templating engine, and you can customize options or register plugins that can further transform your HTML emails.

options

You may pass in options to configure PostHTML.

directives

You can configure the PostHTML parser to correctly process custom directives.

For example, you may tell it to ignore <?php ?> tags instead of treating them as HTML:

config.js
module.exports = {
  build: {
    posthtml: {
      options: {
        directives: [
          { name: '?php', start: '<', end: '>' }
        ]
      }
    }
  }
}

singleTags

Use the singleTags option to tell PostHTML to treat custom tags as self-closing.

config.js
module.exports = {
  build: {
    posthtml: {
      options: {
        singleTags: ['custom']
      }
    }
  }
}

You may then use the <custom /> tag as self-closing:

src/templates/example.html
<custom name="opencounter" type="tracking" />

Checkout the PostHTML documentation as well as the posthtml-render documentation for all available options.

plugins

Register any PostHTML plugins you would like to use:

config.js
module.exports = {
  build: {
    posthtml: {
      plugins: [
        require('posthtml-spaceless')()
      ]
    }
  }
}

Maizzle already uses the following plugins, no need to add them:


Copyright © 2022 Maizzle Edit this page on GitHub