zola: Cachebust for Sass files broken in 0.14.0?

Bug Report

Environment

Zola version: 0.14.0

Expected Behavior

Linking to a Sass stylesheet style.scss that is compiled to style.css, using get_url(path="style.css", cachebust=true), should produce a URL to this file. This works in 0.12.2.

Current Behavior

In Zola 0.14.0, the exact same get_url(path="style.css", cachebust=true) gives the following error:

Building site...
Checking all internal links with anchors.
> Successfully checked 0 internal link(s) with anchors.
-> Creating 3 pages (0 orphan), 1 sections, and processing 0 images
Error: Failed to render page '<site path>/content/about.md'
Reason: Failed to render 'page.html' (error happened in a parent template)
Reason: Function call 'get_url' failed
Reason: `get_url`: Could not find or open file style.css

The error disappears when removing cachebust=true.

Step to reproduce

  • Create Sass stylesheet style.scss;
  • Link to it in a template using <link rel="stylesheet" href="{{ get_url(path='style.css', cachebust=true) }}">

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 19 (10 by maintainers)

Most upvoted comments

Actually it’s just that I completely forgot to add the public dir ot the list of folders to check in for all the files related Tera function >_> So that’s an easy fix at least, I might get to it this weekend but essentially the output path needs to be added in https://github.com/getzola/zola/blob/master/components/templates/src/global_fns/helpers.rs#L7-L21 It also needs to be passed around from the Site since it’s configurable.

I think that we should always error if there’s a call to get_url with an unresolvable file

No, because some people generate some JS files through some build system for example and the JS step might be ran before or after zola and it should work in both cases hopefully.

I believe the easy fix here is to move the Sass generation at the started of the build but cachebust will still be an issue for those assets coming from other systems.

Should be fixed in 0.14.1