Add configuration parameter to override the stylesheet

This commit adds new configuration parameter, THEME_CSS_OVERRIDES, which
can contain a sequence (list, tuple, etc) of URLs to extra stylesheets
that will be used to override default theme appearance. Both absolute and
relative URLs are supported.

It makes the theme more flexible by allowing small stylesheet tweaks
without requiring to maintain a fork of the whole theme.

When this parameter is not set the theme behaves same as before.
This commit is contained in:
Vitaly Potyarkin 2019-09-19 14:24:09 +03:00
commit 63e4576c4a
2 changed files with 9 additions and 0 deletions

View file

@ -21,6 +21,13 @@
<link rel="stylesheet" href="{{ SITEURL }}/theme/css/font-awesome.min.css">
<link rel="stylesheet" href="{{ SITEURL }}/theme/css/pygments/{{ PYGMENTS_STYLE|default('default') }}.min.css">
<link rel="stylesheet" href="{{ SITEURL }}/theme/css/theme.css">
{% for stylesheet in THEME_CSS_OVERRIDES or () %}
{% if stylesheet|lower|truncate(4, True, '') == 'http' %}
<link rel="stylesheet" href="{{ stylesheet }}">
{% else %}
<link rel="stylesheet" href="{{ SITEURL + '/' + stylesheet }}">
{% endif %}
{% endfor %}
{% include 'include/xml_feeds.html' %}
{% block head %}{% endblock %}