Added filter to suffix strings with a timestamp query string.
This is useful for changes made to the stylesheets for cache-busting purposes.
This commit is contained in:
parent
ff39763b5e
commit
e33729852e
2 changed files with 5 additions and 1 deletions
|
|
@ -14,6 +14,10 @@ module.exports = config => {
|
||||||
// Timestamp for datetime element
|
// Timestamp for datetime element
|
||||||
config.addFilter('timestamp', dates.timestamp)
|
config.addFilter('timestamp', dates.timestamp)
|
||||||
|
|
||||||
|
config.addFilter('ts_suffix', (s) => {
|
||||||
|
return s + "?" + Date.now()
|
||||||
|
})
|
||||||
|
|
||||||
// Remove whitespace from a string
|
// Remove whitespace from a string
|
||||||
config.addNunjucksFilter('spaceless', helpers.spaceless)
|
config.addNunjucksFilter('spaceless', helpers.spaceless)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
{% if helpers.environment === 'development' %}
|
{% if helpers.environment === 'development' %}
|
||||||
<link rel="stylesheet" href="{{ '/css/main.css' | url }}">
|
<link rel="stylesheet" href="{{ '/css/main.css' | url }}">
|
||||||
{% else %}
|
{% else %}
|
||||||
<link rel="stylesheet" href="{{ '/css/main.min.css' | url }}">
|
<link rel="stylesheet" href="{{ '/css/main.min.css' | url | ts_suffix }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{# include javascript #}
|
{# include javascript #}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue