diff options
| author | Xe Iaso <me@xeiaso.net> | 2023-07-16 17:22:44 -0400 |
|---|---|---|
| committer | Xe Iaso <me@xeiaso.net> | 2023-07-16 17:22:44 -0400 |
| commit | cab6efd92701f53dd41c5dbdf4d14651d78ad8d6 (patch) | |
| tree | 40455d2ec4632bc10fb781fbcdfad6753f97cee9 /src/handlers/tailwind.rs | |
| parent | 2b7d1f0f864fbdca242ce5714c7977de495bed03 (diff) | |
| download | xesite-xedium.tar.xz xesite-xedium.zip | |
xedium groundworkxedium
Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'src/handlers/tailwind.rs')
| -rw-r--r-- | src/handlers/tailwind.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/handlers/tailwind.rs b/src/handlers/tailwind.rs new file mode 100644 index 0000000..621565a --- /dev/null +++ b/src/handlers/tailwind.rs @@ -0,0 +1,22 @@ +use std::sync::Arc; +use axum::response::IntoResponse; +use axum::{Extension, extract::Path}; +use encre_css::Config; +use http::{HeaderMap, header}; +use crate::app::State; +use super::blog; + +#[instrument(skip(state, headers))] +pub async fn post_view( + Path(name): Path<String>, + Extension(state): Extension<Arc<State>>, + headers: HeaderMap, +) -> impl IntoResponse { + let mut config = Config::default(); + + encre_css_typography::register(&mut config); + + let (_code, body) = blog::post_view(Path(name), Extension(state), headers).await.unwrap(); + + ([(header::CONTENT_TYPE, "text/css")], encre_css::generate([body.0.as_str()], &config)) +} |
