Closed PatrickVanRietschoten closed 5 years ago
I just implemented this custom filter:
const email = new Email({ message: { from: "example@example.org", }, transport, // uncomment below to send emails in development/test env: send: true, views: { root: path.join(__dirname, "..", "emails"), locals: { filters: { 'my-own-filter': function (text, options) { if (options.addStart) text = 'Start\n' + text; if (options.addEnd) text = text + '\nEnd'; return text; } }, }, }, })
:my-own-filter(addStart addEnd) Filter Body
Inspired by: https://pugjs.org/language/filters.html
However, it took me almost 2 hours to find out how. I eventually found out by looking at Lad's source code for translations.
Would be better to have this in the documentation I think...
The rest is pretty awesome! Keep it up!
I just implemented this custom filter:
Inspired by: https://pugjs.org/language/filters.html
However, it took me almost 2 hours to find out how. I eventually found out by looking at Lad's source code for translations.
Would be better to have this in the documentation I think...
The rest is pretty awesome! Keep it up!