zola
zola copied to clipboard
`get_url` inside SASS/CSS
I realize this could be technically challenging to implement, but it'd be great to have a way to call get_url
(or some other similar URL-processing step) from inside SASS/CSS files. The primary use-case I have in mind is as follows:
-
style.sass
references font or image resources required for the page in aurl(...)
-
cachebust=true
is passed toget_url
, since the server uses aggressive caching headers and the fonts or images could be modified in the future - there is a
link rel="preload"
element in the HTML pointing to the font or image resources, such that these resources can start being fetched without waiting forstyle.css
to arrive first
In this scenario, the preload
URL and the one in the CSS must match exactly including query arguments, or else the resource will be fetched twice and the preloaded resource will be unused.
Right now, get_url
already works very well in the preload link, but all of the query arguments have to be appended manually to URLs in stylesheets.