Pregunta

I want to create a set of widgets (tables, calendars, etc) that can be include in HTML emails we send out via Mandrill. I already have these widgets build as components pulled into web pages, I would like to reuse them in emails but in order to do that I need to inline the CSS.

I have tried using https://github.com/roverdotcom/django-inlinecss, which appears to do what I want but doesn't appear to support S3 as a staticfiles source and I can't get it to run locally. Using the tag {% inlinecss "/css/main.css" %} gives an error:

"The joined path (/css/main.css) is located outside of the base path component ([my local path]/static)" from the contrib.staticfile.find_location call to safe_join.

Question 1: can I use django-inlinecss with S3 as a staticfiles repo as it stands or would I have to fork and enhance it?

Question 2: if 1 is possible, what do I need to do to get django-inlinecss running successfully locally?

Question 3: if 1 is not possible does anyone have any alternative suggestions for inlining css using the django tempting framework.

Thanks in advance - Guy.

¿Fue útil?

Solución

In the end Mandrill already solved this problem. I the message dict of the API call to mandrill you can tell Mandrill to inline the css for you.

message['inline_css'] = True

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top