Update ructe.

This commit is contained in:
Rasmus Kaj 2019-04-20 22:04:09 +02:00
parent dd16beb014
commit 7e1c79fa8b
2 changed files with 12 additions and 21 deletions

View File

@ -7,7 +7,7 @@ edition = "2018"
build = "src/build.rs"
[build-dependencies]
ructe = { version = "^0.5.0", features = ["sass", "mime02"] }
ructe = { version = "^0.6.2", features = ["sass", "mime02"] }
[dependencies]
nickel = "~0.10.0"

View File

@ -1,22 +1,13 @@
extern crate ructe;
use ructe::{Ructe, RucteError};
use ructe::{compile_templates, StaticFiles};
use std::env;
use std::path::PathBuf;
fn main() {
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
let base_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
let mut statics = StaticFiles::new(&out_dir).unwrap();
let s_dir = base_dir.join("res");
statics.add_sass_file(&s_dir.join("photos.scss")).unwrap();
statics.add_file(&s_dir.join("admin.js")).unwrap();
statics.add_file(&s_dir.join("ux.js")).unwrap();
statics
.add_files_as(&s_dir.join("leaflet-1.3.1"), "l131")
.unwrap();
statics
.add_files_as(&s_dir.join("leaflet-cluster-1.3.0"), "lm130")
.unwrap();
compile_templates(&base_dir.join("templates"), &out_dir).unwrap();
fn main() -> Result<(), RucteError> {
let mut ructe = Ructe::from_env()?;
let mut statics = ructe.statics()?;
statics.add_sass_file("res/photos.scss")?;
statics.add_file("res/admin.js")?;
statics.add_file("res/ux.js")?;
statics.add_files_as("res/leaflet-1.3.1", "l131")?;
statics.add_files_as("res/leaflet-cluster-1.3.0", "lm130")?;
ructe.compile_templates("templates")?;
Ok(())
}