From 16b75812b2c99095e228c4ad63aad618b05b140e Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 26 Nov 2017 14:23:49 +0000 Subject: [PATCH] Cleanup build file --- build.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/build.rs b/build.rs index 1c09f9d..e0c6de8 100644 --- a/build.rs +++ b/build.rs @@ -13,16 +13,19 @@ const ASSET_KEY: &str = "SRC"; const STATIC_DIR: &str = "static"; fn build_stylesheet() { - let mut in_file = File::open("static/style.scss").expect("Failed to open scss file"); + let mut in_file = + File::open(Path::new(STATIC_DIR).join("style.scss")).expect("Failed to open scss file"); let mut buffer = Vec::new(); in_file.read_to_end(&mut buffer).expect("Failed to read scss"); - let compiled = compile_scss(buffer.as_slice(), OutputStyle::Compressed).expect("SCSS compiler failed"); - let mut out_file = File::create("assets/style.css").expect("Failed to open css file"); + let compiled = + compile_scss(buffer.as_slice(), OutputStyle::Compressed).expect("SCSS compile failed"); + let mut out_file = + File::create(Path::new(ASSETS_DIR).join("style.css")).expect("Failed to open css file"); out_file.write_all(&mut compiled.as_slice()).expect("Failed to write css to file"); } fn embed_assets() { - let out_dir = env::var("OUT_DIR").unwrap(); + let out_dir = env::var("OUT_DIR").expect("Missing output directory variable"); let dest_path = Path::new(&out_dir).join("assets.rs"); include_dir(ASSETS_DIR).as_variable(ASSET_KEY).to_file(dest_path).unwrap(); }