Skip to content

Commit e3345a4

Browse files
author
Michael Morgan
committed
compile fonts.scss on app launch
1 parent 2230f2f commit e3345a4

File tree

4 files changed

+8
-409
lines changed

4 files changed

+8
-409
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
**/*.rs.bk
33
/node_modules
44
/static/styles/app.css
5+
/static/styles/fonts.css
56
/static/styles/*.map
67
.sass-cache
78
localhost*

src/main.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,16 +226,19 @@ fn catch_error() -> Template {
226226
not_found()
227227
}
228228

229-
fn compile_sass() {
230-
let scss = "./src/styles/app.scss";
229+
fn compile_sass(filename: &str) {
230+
let scss = format!("./src/styles/{}.scss", filename);
231231
let css = compile_file(scss, Options::default()).expect("couldn't compile sass");
232-
let mut file = File::create("./static/styles/app.css").expect("couldn't make css file");
232+
let mut file =
233+
File::create(format!("./static/styles/{}.css", filename)).expect("couldn't make css file");
233234
file.write_all(&css.into_bytes())
234235
.expect("couldn't write css file");
235236
}
236237

237238
fn main() {
238-
compile_sass();
239+
compile_sass("app");
240+
compile_sass("fonts");
241+
239242
rocket::ignite()
240243
.attach(Template::fairing())
241244
.mount(
File renamed without changes.

0 commit comments

Comments
 (0)