fixup! refacto: extract livereload layer setup into a function
This commit is contained in:
parent
60a409f20a
commit
dfdf0d3bae
@ -3,10 +3,10 @@ use axum::body::Body;
|
|||||||
use axum::http::Request;
|
use axum::http::Request;
|
||||||
use listenfd::ListenFd;
|
use listenfd::ListenFd;
|
||||||
use notify::Watcher;
|
use notify::Watcher;
|
||||||
use tower_livereload::predicate::Predicate;
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use tokio::net::TcpListener;
|
use tokio::net::TcpListener;
|
||||||
|
use tower_livereload::predicate::Predicate;
|
||||||
use tower_livereload::LiveReloadLayer;
|
use tower_livereload::LiveReloadLayer;
|
||||||
|
|
||||||
/// Nous filtrons les requêtes de `htmx` pour ne pas inclure le script _JS_ qui gère le rechargement
|
/// Nous filtrons les requêtes de `htmx` pour ne pas inclure le script _JS_ qui gère le rechargement
|
||||||
@ -39,8 +39,8 @@ fn get_livereload_layer(templates_path: &Path) -> LiveReloadLayer<NotHtmxPredica
|
|||||||
let reloader = livereload.reloader();
|
let reloader = livereload.reloader();
|
||||||
let mut watcher = notify::recommended_watcher(move |_| reloader.reload()).unwrap();
|
let mut watcher = notify::recommended_watcher(move |_| reloader.reload()).unwrap();
|
||||||
watcher
|
watcher
|
||||||
.watch(templates_path, notify::RecursiveMode::Recursive)
|
.watch(templates_path, notify::RecursiveMode::Recursive)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
livereload.request_predicate::<Body, NotHtmxPredicate>(NotHtmxPredicate)
|
livereload.request_predicate::<Body, NotHtmxPredicate>(NotHtmxPredicate)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user