XF 2.0 Styling addon email templates

Sim

Well-known member
Wondering what the process for adding custom css to addon email templates is?

I tried adding a <xf:css src="mytemplate.less" /> call to my email template along with corresponding .less template, but it didn't seem to pick up anything I defined in there.

I note that the email HTML seems to have CSS inlined, so there's obviously some magic happening there.
 
I could very well be mistaken, but it doesn't look like you can use custom LESS/CSS templates inside of email templates. The mail styler explicitly includes core.less in PHP. It looks like the class is extendable though, so you might be able to include additional templates that way (see \XF\Mail\Styler::renderCoreCss()). Adding your styling rules to core.less via a template modification may also be an option.
 
Thanks - I was able to use a template modification to add a template with custom definitions to be included in core.less for emails.
 
Back
Top Bottom