Type definition propagate "plaintext" while in fact "generatePlaintext" exported
- Maizzle Version: 5.0.0-beta.24
Please update types.
We could also take the opportunity to rename the function if there's a better/shorter name than generatePlaintext.
First, I'd wanted to thank you for this great lib, I can use to make emails creation a little bit less awful.
IMHO, I wonder why do we have two separate calls at all? In most use cases we do need both html and plaintext variants to compose a message, so it would be great to call render once and get both text and html. If it doesn't make sense for some reason, I'd propose to keep one naming style and rename render to html and generatePlaintext to text. And if you don't worry about the backward compatibility, personally me prefer that kind of interface:
const template = fs.readFileSync(template_name)
const maizzle = new Maizzle(config)
const { html, text } = maizzle.Render(template)
This type of interface is more friendly and support re-use of the initialized Maizzle instance instead of producing a new one each time you call render now.
You can already do render(html, {plaintext: true}), the plaintext method is for cases where you might need to only generate plaintext and not compile any templates.