Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.
SOLVED

Embed CSS in Email JSP template

Avatar

Level 4

It is best practice to place styles inline and in the <head> for an HTML email to cover the most clients.  As we add components to an email, how can we inject styles into the <head> of the email being developed.  If we simply include the clientLibs we get a linked resources so that doesn't work.  Someone mentioned inputStream.  Is that the best way and if so, can someone point us to an example of this?

1 Accepted Solution

Avatar

Correct answer by
Employee

Look at the code here:

https://github.com/Adobe-Consulting-Services/acs-aem-commons/blob/master/bundle/src/main/java/com/ad...

This code shows you how to read the content of a clientlib, check this line: htmlLibrary.getInputStream()

This you can use to write some custom code around it.

View solution in original post

3 Replies

Avatar

Level 10

Most AEM developers use ClientLibs to handle CSS - as discussed in this official AEM documentation:

http://docs.adobe.com/docs/en/cq/current/developing/clientlibs.html

Why are you opposed to using Clientlibs in an AEM solution? 

Avatar

Level 4

We are using clientLibs extensively of course, but emails need "inline" styles in the element tags and in the head and not linked libs.

Avatar

Correct answer by
Employee

Look at the code here:

https://github.com/Adobe-Consulting-Services/acs-aem-commons/blob/master/bundle/src/main/java/com/ad...

This code shows you how to read the content of a clientlib, check this line: htmlLibrary.getInputStream()

This you can use to write some custom code around it.