I want to generate GSP templates for html emails. To support more mail clients it is recommended to use inline css in html style elements.
Here is a discussion on that topic: "Compile" CSS into HTML as inline styles
Is there a Grails plugin where I can specify certain GSP files for which the CSS should be compiled as inline?
If there is no plugin, how can I specify GSP files for which the css should be complied inline?
Here is an example. I have the following GSP templates for my html mails that I send with the Grails mail plugin.
/mail/signup_mail.gsp
/mail/welcome.gsp
/mail/newsletter.gsp
Each GSP file includes a style.css file. This should be compiled inline.
To add inline CSS in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with CSS properties such as font-family, font-style, text-decoration, direction, etc. Just keep in mind, the usage of style attribute overrides any style set globally.
An inline style may be used to apply a unique style for a single element. To use inline styles, add the style attribute to the relevant element. The style attribute can contain any CSS property.
An inline CSS is used to apply a unique style to a single HTML element. An inline CSS uses the style attribute of an HTML element.
Inline CSS is considered useful as it reduces the number of files that the browser needs to download before displaying the web page. With an external CSS, the browser first loads an HTML file and then downloads the CSS file.
We do this with a free method on the Mailchimp API. You can also use Premailer.
http://apidocs.mailchimp.com/api/1.2/inlinecss.func.php
http://premailer.dialect.ca/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With