Add cache-busted static asset helper (#2804)

* Add cache-busted static asset helper

Add a static() helper for Datasette, plugin, and mounted static assets that appends content-based hashes, caches hashes in production, and serves matching hashed asset URLs with immutable far-future cache headers.

Closes #2800
This commit is contained in:
Simon Willison 2026-06-23 13:44:58 -07:00 • committed by GitHub
commit 5eca46a4bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 361 additions and 65 deletions

View file

@ -1968,9 +1968,8 @@ Here is a minimal plugin example that adds a button to a table page and loads Ja
@hookimpl
def extra_js_urls(datasette):
return [
datasette.urls.static_plugins(
"datasette_show_table",
"show-table.js",
datasette.static(
"show-table.js", plugin="datasette_show_table"
)
]