Ajoute un livereload de développement

Feature cargo `livereload` (tower-livereload, désactivée par défaut) :
script injecté dans les pages hors requêtes htmx, assets en no-cache.
À lancer avec watchexec (cf. README).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Romulus21andClaude Opus 5.5 committed 2026-11-13 18:17:47 +01:00
1 parent fdba078b51
commit f4c94f9b5b
5 files changed
+47 -2

No files matched your search

+8 -1
View File
@@ -56,11 +56,18 @@ pub fn app(pool: SqlitePool) -> Router {
.with_state(pool)
}
// En livereload, le CSS/JS doit être relu à chaque rechargement.
const CACHE_CONTROL: &str = if cfg!(feature = "livereload") {
"no-cache"
} else {
"public, max-age=3600"
};
async fn asset(content_type: &'static str, body: &'static str) -> impl IntoResponse {
(
[
(header::CONTENT_TYPE, content_type),
(header::CACHE_CONTROL, "public, max-age=3600"),
(header::CACHE_CONTROL, CACHE_CONTROL),
],
body,
)