Reputation: 958
For example:
{% compress css %}
<link rel="stylesheet" href="{% static 'css/foo.css' %}">
{% if foobar %}
<link rel="stylesheet" href="{% static 'css/bar.css' %}">
{% endif %}
{% endcompress %}
As above, can I have an if
tag inside the compress
tag? Does this work with the OFFLINE_COMPRESSION
mode?
Upvotes: 0
Views: 156
Reputation: 958
I tested it myself. The answer is no, as of Aug. 2018.
A workaround maybe using multiple compress
tags as mentioned by in the other answer.
Upvotes: 0
Reputation: 1844
django-compressor
docs says nothing about it. But you can use few {% compress %}
tags like this:
{% compress css %}
<link rel="stylesheet" href="{% static 'css/foo.css' %}">
{% endcompress %}
{% if foobar %}
{% compress css %}
<link rel="stylesheet" href="{% static 'css/bar.css' %}">
{% endcompress %}
{% endif %}
Upvotes: 0