ackama / rails-template

Application template for Rails 7 projects; preloaded with best practices for TDD, security, deployment, and developer productivity.
Other
306 stars 17 forks source link

Proposal: include premailer-rails #250

Open joshmcarthur opened 3 years ago

joshmcarthur commented 3 years ago

We frequently use template email layouts, typically Postmark's. These templates, and many others, advise using an email HTML preprocessor such as premailer to inline CSS onto the elements. Apparently using <style> tags and or <link rel="stylesheet" has mixed support in different email clients. Premailer can also generate plaintext versions of emails, which is a useful thing to do for accessibility/client support if plaintext templates are not provided by a developer.

Email layouts are something that is frequently disregarded or left until the last minute, so providing a sensible default here would also be useful. Just a single column with header and footer will take care of most projects' needs.

Premailer does not currently support webpacker, although there is a lengthy issue describing how support can be added for it. This doesn't currently impact my project since I'm using the Postmark template with an inline <style> tag, so this may or may not be an issue.

eoinkelly commented 2 years ago

Do we need to care about this being in Webpack?

My instinct is that we probably won't want to re-use stylesheets between the app and the inlined mail styles. Obviously these styles will be related but I think copy & paste is probably safer.

eoinkelly commented 2 years ago

This should probably be a new variant eh?

eoinkelly commented 2 years ago

Discussion outcome: