Emit versioned asset bundles for immutable caching#35
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ca89530663
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| static/sf/sf.css $(VERSIONED_CSS): $(CSS_SRC) | ||
| @printf "$(PROGRESS) CSS sf.css ($(words $(CSS_SRC)) files)\n" | ||
| @cat $(CSS_SRC) > $@ | ||
| @cat $(CSS_SRC) > static/sf/sf.css | ||
| @cp static/sf/sf.css $(VERSIONED_CSS) |
There was a problem hiding this comment.
Regenerate
sf.$(VERSION) bundles in the release path
These rules make the emitted filenames depend on $(VERSION), but the existing release flow does not rebuild them: .versionrc.json only bumps Cargo.toml, and publish still runs cargo publish without depending on assets. In a 0.1.0 -> 0.1.1 release, that means the crate can be published with only sf.0.1.0.{css,js} present, so the newly documented /sf/sf.0.1.1.css and /sf/sf.0.1.1.js URLs will 404 unless the maintainer remembers to run make assets manually.
Useful? React with 👍 / 👎.
| && version.chars().all(|ch| { | ||
| ch.is_ascii_digit() || ch == '.' || ch == '-' || ch.is_ascii_alphabetic() | ||
| }) |
There was a problem hiding this comment.
Accept
+ in versioned bundle names for valid Cargo versions
Cargo accepts package versions with build metadata such as 0.1.0+foo, so the new Makefile can emit sf.0.1.0+foo.css/js. This predicate rejects +, which means those valid versioned bundles fall back to the non-immutable max-age=3600 cache policy and the new caching behavior silently stops working for that class of releases.
Useful? React with 👍 / 👎.
ca89530 to
b9ce5f3
Compare
Closes #16.
Summary
sf.cssandsf.js