[Feature] Add preprocessor support
See original GitHub issueFrom @watzon on November 8, 2017 21:15
Laravel gives us the ability to have blade templates that take blade/markdown and turn it into an HTML email template. This saves some major headache when it comes to making emails beautiful and responsive. It would be awesome if Adonis had the same functionality.
Proposal
Add a markdown method to the Mailer and some built in components that get added to edge templates. Developers should ideally be able to use the markdown method to render an edge template, or send plain markdown which will be parsed into valid email HTML before being sent.
Example Code
<!-- resources/views/emails/shipped.edge -->
@component('mail.message')
# Order Shipped
Your order has been shipped!
@component('mail.button', url = {{ order.viewUrl }})
View Order
@endcomponent
Thanks,<br>
{{ Config('appName') }}
@endcomponent
// app/Controllers/Http/OrdersController.js
await Mail.markdown('emails.shipped', Order.toJSON(), (message) => {
message.subject('Hello ...')
message.from('foo@bar.com')
message.to('baz@bar.com')
})
Reference
https://laravel.com/docs/5.5/mail#markdown-mailables https://www.npmjs.com/package/markdown https://www.npmjs.com/package/markdown-it
Copied from original issue: adonisjs/adonis-mail#15
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:7 (7 by maintainers)
Top GitHub Comments
So Adonis mail doesn’t have any idea on how the view engine works, it just uses Edge. My plan is to let users add preprocessors to Edge, so it will be like this
Raw edge
In Adonis
Idea dropped. Closing