Open diabolo opened 2 years ago
Not sure if I understand your issue @diabolo
Please see an example below where I generate a new template and get both text.slim
and html.slim
templates which seem legit to me:
❯ rails g mailer HelloWorld ping
create app/mailers/hello_world_mailer.rb
invoke slim
create app/views/hello_world_mailer
create app/views/hello_world_mailer/ping.text.slim
create app/views/hello_world_mailer/ping.html.slim
cat app/views/hello_world_mailer/ping.text.slim
' HelloWorld#ping
= "\r\n" * 2
' #{@greeting}, find me in app/views/hello_world_mailer/ping.text.slim
and when you preview that template with http://localhost:3000/rails/mailers/hello_world/ping , it shows clear text, no markup:
HelloWorld#ping
Hi, find me in app/views/hello_world_mailer/ping.text.slim
Whilst working through an example app I came across an issue with email templates generated by rails. Slim isn't really suitable for this because the expected behaviour of rendering plain text as is doesn't happen with slim. I'll illustrate
with an erb template with content
you get output
with a slim template with the same content you get output
This isn't a bug with slim, its fundamental to how slim works.
It would an improvement if slim-rails could fall back to generating an erb template for txt email views. An alternative might be to generate a template with some content like