From 18ffc5f7aee3bbb73c03e835a831fadd9f55df85 Mon Sep 17 00:00:00 2001 From: Araozu Date: Fri, 9 Feb 2024 19:24:06 -0500 Subject: [PATCH] Minimal integration for Maud & Tailwind --- src/main.rs | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 5411c6b..ace50ce 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,11 +1,32 @@ -#[macro_use] extern crate rocket; +use rocket::fs::FileServer; +use maud::{Markup, html, DOCTYPE}; + + +#[macro_use] +extern crate rocket; #[get("/")] -fn index() -> &'static str { - "Hello, world!" +fn index() -> Markup { + html! { + (DOCTYPE) + html { + head { + title { "Hello, world!" } + link rel="stylesheet" type="text/css" href="/static/css/output.css"; + } + body { + h1 class="text-xl text-red-500 bg-slate-300 px-2 py-4 rounded-full font-black" { + "Hello, world!" + } + p { "Welcome to my website!" } + } + } + } } #[launch] fn rocket() -> _ { - rocket::build().mount("/", routes![index]) + rocket::build() + .mount("/", routes![index]) + .mount("/static", FileServer::from("static")) }