Browse Source

Use compile_file for sass

index-subcmd
Vincent Prouillet 7 years ago
parent
commit
7ace63a6c5
3 changed files with 8 additions and 4 deletions
  1. +3
    -4
      components/site/src/lib.rs
  2. +3
    -0
      components/site/test_site/sass/_included.scss
  3. +2
    -0
      components/site/test_site/sass/blog.scss

+ 3
- 4
components/site/src/lib.rs 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)
};


+ 3
- 0
components/site/test_site/sass/_included.scss View File

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

+ 2
- 0
components/site/test_site/sass/blog.scss View File

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

@import "included";

Loading…
Cancel
Save