add flowbite
This commit is contained in:
parent
caeac280eb
commit
5ef37275ec
4 changed files with 48 additions and 8 deletions
24
src/asset.rs
24
src/asset.rs
|
@ -10,12 +10,34 @@ pub fn htmx_script_route() -> DataResponse {
|
|||
)
|
||||
}
|
||||
|
||||
#[get("/assets/flowbite.min.css")]
|
||||
pub fn flowbite_css() -> DataResponse {
|
||||
DataResponse::new(
|
||||
include_str!("flowbite.min.css").as_bytes().to_vec(),
|
||||
"text/css".to_string(),
|
||||
Some(60 * 60 * 24 * 3),
|
||||
)
|
||||
}
|
||||
|
||||
#[get("/assets/flowbite.min.s")]
|
||||
pub fn flowbite_js() -> DataResponse {
|
||||
DataResponse::new(
|
||||
include_str!("flowbite.min.js").as_bytes().to_vec(),
|
||||
"application/javascript".to_string(),
|
||||
Some(60 * 60 * 24 * 3),
|
||||
)
|
||||
}
|
||||
|
||||
pub trait AssetRoutes {
|
||||
fn mount_assets(self) -> Self;
|
||||
}
|
||||
|
||||
impl AssetRoutes for rocket::Rocket<Build> {
|
||||
fn mount_assets(self) -> Self {
|
||||
self.mount("/", routes![crate::asset::htmx_script_route])
|
||||
self.mount("/", routes![
|
||||
crate::asset::htmx_script_route,
|
||||
crate::asset::flowbite_css,
|
||||
crate::asset::flowbite_js
|
||||
])
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,6 +64,8 @@ impl Shell {
|
|||
@if self.ui {
|
||||
script src="https://cdn.tailwindcss.com" {};
|
||||
script src="/assets/htmx.min.js" {};
|
||||
script src="/assets/flowbite.min.js" {};
|
||||
link href="/assets/flowbite.min.css" rel="stylesheet" {};
|
||||
meta name="viewport" content="width=device-width, initial-scale=1.0";
|
||||
};
|
||||
(self.head)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue