I'm working on an email template, therefor I would like to embed a css file
<head><style>{{ embed 'css/TEST.css' content here }}</style>
</head>
instead of linking it
<head><link href="{% static 'css/TEST.css' %}" rel="stylesheet" type="text/css">
</head>
Any ideas?
You can use django-compressor package. It will add {% compress %}
template tag that can join together bunch of JS or CSS files (or inlined code) and put it into template as new, big file or inlined code. For example to inline one CSS file, you can use:
{% compress css inline %}<link href="{% static 'css/TEST.css' %}" rel="stylesheet" type="text/css">
{% endcompress %}
You can add more CSS files into one compress tag, they will be concatenated together and wrapped into one <style>
tag.
Check usage examples for more details.