Use compile_file for sass

This commit is contained in:
Vincent Prouillet 2017-07-09 11:37:05 +09:00
parent d78477b619
commit 7ace63a6c5
3 changed files with 8 additions and 4 deletions

View file

@ -32,11 +32,11 @@ use tera::{Tera, Context};
use walkdir::WalkDir;
#[cfg(not(target_os = "windows"))]
use sass_rs::{Options, compile_string};
use sass_rs::{Options, compile_file};
use errors::{Result, ResultExt};
use config::{Config, get_config};
use utils::fs::{create_file, read_file, create_directory, ensure_directory_exists};
use utils::fs::{create_file, create_directory, ensure_directory_exists};
use content::{Page, Section, populate_previous_and_next_pages, sort_pages};
use templates::{GUTENBERG_TERA, global_fns, render_redirect_template};
use front_matter::{SortBy, InsertAnchor};
@ -462,8 +462,7 @@ impl Site {
for file in files {
let name = file.as_path().file_stem().unwrap().to_string_lossy();
let content = read_file(&file)?;
let css = match compile_string(&content, Options::default()) {
let css = match compile_file(file.as_path().to_str().unwrap(), Options::default()) {
Ok(c) => c,
Err(e) => bail!(e)
};

View file

@ -0,0 +1,3 @@
.container {
font-size: 2rem;
}

View file

@ -5,3 +5,5 @@ body {
background: blue;
}
}
@import "included";