Skip to content

Commit

Permalink
Merge pull request #20 from adworacz/cacheBusting
Browse files Browse the repository at this point in the history
Add cachebusting for CSS.

Explanation: #20 (comment)

TLDR: CSS gets hashed; if it changes, then the hash changes. this gets the browser to fetch the new CSS, allowing large caching values without worrying about new theme changes taking forever to propagate to users.
  • Loading branch information
ejmg authored Jul 28, 2021
2 parents 572d68c + 9ebe720 commit 7630603
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion templates/macros/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
{% endmacro copyright %}

{% macro script() %}
<script type="text/javascript" src="{{ get_url(path="assets/js/main.js" ) }}"></script>
<script type="text/javascript" src="{{ get_url(path="assets/js/main.js") }}"></script>
{% endmacro script %}
8 changes: 4 additions & 4 deletions templates/macros/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
-#}

{% macro styling() %}
<link rel="stylesheet" href="{{ get_url(path="style.css") }}">
<link rel="stylesheet" href="{{ get_url(path="style.css", cachebust=true) }}">
{% if config.extra.theme_color != "orange" -%}
{% set color = "color/" ~ config.extra.theme_color ~ ".css" -%}
<link rel="stylesheet" href="{{ get_url(path=color) }}">
<link rel="stylesheet" href="{{ get_url(path=color, cachebust=true) }}">
{%- else -%}
<link rel="stylesheet" href=" {{ get_url(path="color/orange.css") }}">
<link rel="stylesheet" href=" {{ get_url(path="color/orange.css", cachebust=true) }}">
{% endif %}
{%- if config.extra.custom_css is defined -%}
<link rel="stylesheet" href="{{ get_url(path="custom.css") }}">
<link rel="stylesheet" href="{{ get_url(path="custom.css", cachebust=true) }}">
{% endif %}
{% endmacro styling %}

Expand Down

1 comment on commit 7630603

@vercel
Copy link

@vercel vercel bot commented on 7630603 Jul 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

Please sign in to comment.