Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile CSS into HTML as Inline Style in Grails?

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.

like image 575
confile Avatar asked Oct 15 '13 13:10

confile


People also ask

How do you add an inline stylesheet in HTML?

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.

How do you create an inline style?

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.

What is inline CSS in HTML?

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.

Is CSS better for inline?

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.


1 Answers

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/

like image 94
Jamey Avatar answered Sep 26 '22 10:09

Jamey