Generate CSS assets during build
The main CSS file will import everything from Bootstrap and Font Awesome and provide a way to override things.
This commit is contained in:
parent
1bd7166313
commit
76a981444e
3 changed files with 48 additions and 0 deletions
20
ui/build.rs
Normal file
20
ui/build.rs
Normal file
|
@ -0,0 +1,20 @@
|
|||
// Generates static assets.
|
||||
|
||||
use std::env;
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
|
||||
use sass_rs::{self, Options};
|
||||
|
||||
fn main() {
|
||||
let dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
||||
let scss_dir = Path::new(&dir).join("scss");
|
||||
let source_css_file = scss_dir.join("stoptime.scss");
|
||||
let css_dir = Path::new(&dir).join("static").join("css");
|
||||
let target_css_file = css_dir.join("stoptime.css");
|
||||
|
||||
let sass = sass_rs::compile_file(&source_css_file, Options::default()).unwrap();
|
||||
let mut f = File::create(&target_css_file).unwrap();
|
||||
f.write_all(sass.as_bytes()).unwrap();
|
||||
}
|
28
ui/scss/stoptime.scss
Normal file
28
ui/scss/stoptime.scss
Normal file
|
@ -0,0 +1,28 @@
|
|||
// Include all of Bootstrap.
|
||||
@import "bootstrap/bootstrap";
|
||||
|
||||
// Include all of Font Awesome.
|
||||
@import "fontawesome/fontawesome";
|
||||
|
||||
/* StopTime's main CSS (overrides)
|
||||
*/
|
||||
|
||||
// Prepare for the fixed-top navbar.
|
||||
html {
|
||||
position: relative;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
// Add some padding for the fixed-top navbar.
|
||||
body {
|
||||
padding-top: 80px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
footer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 24px;
|
||||
line-height: 24px;
|
||||
}
|
0
ui/static/css/.gitkeep
Normal file
0
ui/static/css/.gitkeep
Normal file
Loading…
Reference in a new issue