From 5c20c00d6d6e538cae8f016d719dcdd91ed34835 Mon Sep 17 00:00:00 2001 From: Joe Ling - uni laptop Date: Mon, 13 Jul 2020 18:53:53 +0100 Subject: [PATCH] updated comments for import and from_paths --- src/lib.rs | 10 ++++++++++ src/parse/import.rs | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index b65735e..02404a3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -143,6 +143,16 @@ pub fn from_path(p: &str) -> Result { from_paths(p, &Vec::new()) } +/// Compile CSS from a file and load in additional files through importing them +/// note: @use is currently unsupported +/// +/// ``` +/// fn main() -> Result<(), Box> { +/// let sass = grass::from_paths("input.scss", &[std::path::Path::new("benches")])?; +/// Ok(()) +/// } +/// ``` +/// (grass does not currently allow files or paths that are not valid UTF-8) #[cfg_attr(feature = "profiling", inline(never))] #[cfg_attr(not(feature = "profiling"), inline)] #[cfg(not(feature = "wasm"))] diff --git a/src/parse/import.rs b/src/parse/import.rs index 83816ef..dcc0ba3 100644 --- a/src/parse/import.rs +++ b/src/parse/import.rs @@ -9,8 +9,8 @@ use super::{Parser, Stmt}; /// Searches the current directory of the file then searches in load paths directories /// if the import has not yet been found. -/// [https://sass-lang.com/documentation/at-rules/import#finding-the-file](finding a file) -/// [https://sass-lang.com/documentation/at-rules/import#load-paths](load path) +/// +/// fn find_import(file_path: &PathBuf, name: &OsStr, load_paths: &[&Path]) -> Option { let paths = [ file_path.with_file_name(name).with_extension("scss"),