diff options
| author | Fuwn <[email protected]> | 2023-03-11 07:04:22 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-03-11 07:04:22 +0000 |
| commit | 695b73133e1ce462f912656d762d0de4bbed5e47 (patch) | |
| tree | 6ba3a2333fc846086ceb745db6bb4a303080e457 /src | |
| parent | ci(check.yaml): correct rust toolchain (diff) | |
| download | september-695b73133e1ce462f912656d762d0de4bbed5e47.tar.xz september-695b73133e1ce462f912656d762d0de4bbed5e47.zip | |
feat(response): allow multiple css files
Diffstat (limited to 'src')
| -rw-r--r-- | src/response.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/response.rs b/src/response.rs index 547cf12..393e3b8 100644 --- a/src/response.rs +++ b/src/response.rs @@ -141,10 +141,15 @@ pub async fn default( // Try to add an external stylesheet from the `CSS_EXTERNAL` environment // variable. if let Ok(css) = var("CSS_EXTERNAL") { - html_context.push_str(&format!( - "<link rel=\"stylesheet\" type=\"text/css\" href=\"{}\">", - css - )); + let stylesheets = + css.split(',').filter(|s| !s.is_empty()).collect::<Vec<_>>(); + + for stylesheet in stylesheets { + html_context.push_str(&format!( + "<link rel=\"stylesheet\" type=\"text/css\" href=\"{}\">", + stylesheet, + )); + } } // Try to add an external favicon from the `FAVICON_EXTERNAL` environment |