-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
529 additions
and
30 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,50 @@ | ||
//! Contains routes for static files | ||
use axum::response::IntoResponse; | ||
use axum::{ | ||
http::header::CACHE_CONTROL, | ||
response::{AppendHeaders, IntoResponse}, | ||
}; | ||
use tracing::debug; | ||
|
||
/// Tailwind-generated CSS used on this web page | ||
/// | ||
/// `npx tailwindcss -i base_style.css -o ../static/tailwind_style.css --watch` | ||
const STYLING: &str = include_str!("../static/tailwind_style.css"); | ||
|
||
/// HTMX code (<https://htmx.org/docs/#installing>) | ||
/// HTMX code | ||
/// | ||
/// <https://htmx.org/docs/#installing> | ||
const HTMX: &str = include_str!("../static/htmx.min.2.0.3.js"); | ||
|
||
/// plotly.js code | ||
/// | ||
/// <https://github.com/plotly/plotly.js#load-via-script-tag> | ||
const PLOTLY: &str = include_str!("../static/plotly-2.35.2.min.js"); | ||
|
||
/// GET `/styles.css` - CSS | ||
/// | ||
/// Idk yet how, but should be cached somehow for the future so that | ||
/// it isn't requested on each load in full? idk | ||
/// it isn't requested on each load in full? idk (but also is invalidated in rapid dev..) | ||
pub async fn styles() -> impl IntoResponse { | ||
debug!("GET /styles.css"); | ||
|
||
axum_extra::response::Css(STYLING) | ||
} | ||
|
||
/// GET `/htmx.js` - HTMX | ||
/// | ||
/// Idk yet how, but should be cached somehow for the future so that | ||
/// it isn't requested on each load in full? idk | ||
pub async fn htmx() -> impl IntoResponse { | ||
debug!("GET /htmx.js"); | ||
|
||
axum_extra::response::JavaScript(HTMX) | ||
let headers = AppendHeaders([(CACHE_CONTROL, "public, max-age=31536000, immutable")]); | ||
|
||
(headers, axum_extra::response::JavaScript(HTMX)) | ||
} | ||
|
||
/// GET `/plotly.js` - plotly.js | ||
pub async fn plotly() -> impl IntoResponse { | ||
debug!("GET /plotly.js"); | ||
|
||
let headers = AppendHeaders([(CACHE_CONTROL, "public, max-age=31536000, immutable")]); | ||
|
||
(headers, axum_extra::response::JavaScript(PLOTLY)) | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters