Fix css hot reload
This commit is contained in:
parent
315474b708
commit
cf65d5b8e9
3 changed files with 9 additions and 0 deletions
|
@ -100,7 +100,9 @@ opt-level = 'z'
|
||||||
name = "portfolio"
|
name = "portfolio"
|
||||||
site-root = "target/site"
|
site-root = "target/site"
|
||||||
site-pkg-dir = "pkg"
|
site-pkg-dir = "pkg"
|
||||||
|
style-file = "style/main.scss" # Important for Hot Reload to work properly (File must exist)
|
||||||
tailwind-input-file = "style/portfolio.css"
|
tailwind-input-file = "style/portfolio.css"
|
||||||
|
watch-additional-files = ["data_src"]
|
||||||
assets-dir = "public"
|
assets-dir = "public"
|
||||||
site-addr = "127.0.0.1:3000"
|
site-addr = "127.0.0.1:3000"
|
||||||
reload-port = 3001
|
reload-port = 3001
|
||||||
|
|
|
@ -10,6 +10,12 @@ cfg_if! {
|
||||||
use leptos_actix::{generate_route_list, LeptosRoutes};
|
use leptos_actix::{generate_route_list, LeptosRoutes};
|
||||||
use simple_logger::SimpleLogger;
|
use simple_logger::SimpleLogger;
|
||||||
|
|
||||||
|
#[get("/style.css")]
|
||||||
|
async fn css() -> impl Responder {
|
||||||
|
actix_files::NamedFile::open_async("./style/output.css").await
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
// Configure logger
|
// Configure logger
|
||||||
|
@ -38,6 +44,7 @@ cfg_if! {
|
||||||
.app_data(web::Data::clone(&data)) // Must panic if data can't be loaded
|
.app_data(web::Data::clone(&data)) // Must panic if data can't be loaded
|
||||||
.route("/api/{tail:.*}", leptos_actix::handle_server_fns())
|
.route("/api/{tail:.*}", leptos_actix::handle_server_fns())
|
||||||
.leptos_routes(leptos_options.to_owned(), routes.to_owned(), || view! { <App/> })
|
.leptos_routes(leptos_options.to_owned(), routes.to_owned(), || view! { <App/> })
|
||||||
|
.service(css)
|
||||||
.service(Files::new("/", site_root))
|
.service(Files::new("/", site_root))
|
||||||
.wrap(middleware::Compress::default())
|
.wrap(middleware::Compress::default())
|
||||||
})
|
})
|
||||||
|
|
0
style/main.scss
Normal file
0
style/main.scss
Normal file
Loading…
Reference in a new issue