Add attributes
Maizzle can automatically add attributes to HTML elements in your email templates. This can be useful for:- adding default attributes based on build Environment or Template
- not having to write required attributes all the time
- automating email accessibility
attributes.add key in your config defines which elements in your emails should receive which attributes with what values.
Usage
Here is how you would add arole="article" attribute to a <div>:
config.js
Default attributes
By default, Maizzle makes any<table> accessible, resets its spacing, and ensures that an empty alt="" attribute is added to images that don’t have it.
This is the default configuration:
Attributes will be added only if they’re not already present on the element.
Disabling
You may turn this off by settingextraAttributes to false in your config:
config.js
Selectors
Tag, class, id, and attribute selectors are supported:config.js
Multiple selectors
Add multiple attributes to multiple elements in one go:config.js
Tailwind CSS
Any Tailwind CSS classes that you add with this Transformer need to be added to yourcontent key, otherwise they will not be generated.
To do this, simply add the path to your config.js file to the content array:
tailwind.config.js
API
app.js