mirror of
https://github.com/svenstaro/miniserve
synced 2024-07-05 17:18:56 +00:00
more feedback
This commit is contained in:
parent
89d96b9d7f
commit
e58f078bf0
8
build.rs
8
build.rs
|
@ -3,15 +3,17 @@ use std::fs;
|
|||
use std::path::Path;
|
||||
|
||||
fn main() {
|
||||
let out_dir = env::var_os("OUT_DIR").expect("out dir env var missing");
|
||||
let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR env var missing");
|
||||
let dest_path = Path::new(&out_dir).join("style.css");
|
||||
fs::write(
|
||||
&dest_path,
|
||||
grass::from_string(
|
||||
include_str!("data/style.scss").to_string(),
|
||||
&grass::Options::default(),
|
||||
).expect("scss failed to compile"),
|
||||
).expect("failed to write css file");
|
||||
)
|
||||
.expect("scss failed to compile"),
|
||||
)
|
||||
.expect("failed to write css file");
|
||||
|
||||
println!("cargo:rerun-if-changed=data/style.scss");
|
||||
}
|
||||
|
|
|
@ -41,12 +41,12 @@ pub fn page(
|
|||
(page_header(&title_path, file_upload, favicon_route, css_route))
|
||||
|
||||
body#drop-container
|
||||
// Add classes to body selecting default light and dark theme
|
||||
.(format!("default_theme_{}", default_color_scheme))
|
||||
.(format!("default_theme_dark_{}", default_color_scheme_dark)) {
|
||||
|
||||
(PreEscaped(r#"
|
||||
<script>
|
||||
// read theme from local storage and apply it to body
|
||||
const body = document.body;
|
||||
var theme = localStorage.getItem('theme');
|
||||
|
||||
|
@ -54,6 +54,8 @@ pub fn page(
|
|||
body.classList.add('theme_' + theme);
|
||||
}
|
||||
|
||||
// updates the color scheme by replacing the appropriate class
|
||||
// on body and saving the new theme to local storage
|
||||
function updateColorScheme(name) {
|
||||
body.classList.remove.apply(body.classList, Array.from(body.classList).filter(v=>v.startsWith("theme_")));
|
||||
|
||||
|
@ -475,7 +477,6 @@ pub fn render_error(
|
|||
html {
|
||||
(page_header(&error_code.to_string(), false, favicon_route, css_route))
|
||||
|
||||
// Add classes to body selecting default light and dark theme
|
||||
body.(format!("default_theme_{}", default_color_scheme))
|
||||
.(format!("default_theme_dark_{}", default_color_scheme_dark)) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user