Minify Email Code
Use the minify
option to trim down the HTML size of your production emails.
Minified email code weighs less in KB, resulting in faster sendouts, faster opens, and bandwidth savings on limited mobile data plans. Every little bit helps 🙂
Additionally, it reduces the risk of Gmail clipping.
Usage
config.js
module.exports = {
minify: true,
}
Customization
You may configure the underlying html-crush
library:
config.js
module.exports = {
minify: {
lineLengthLimit: 500,
removeIndentations: true,
breakToTheLeftOf: [],
}
}
Checkout the full list of html-crush options.
Minifying email code can lead to unexpected results if not done properly. Make sure you know what you're doing, and always test your emails!
API
app.js
const {minify} = require('@maizzle/framework')
const options = {/* html-crush options */}
const html = await minify('html string', options)
Copyright © 2022 Maizzle
Edit this page on GitHub