updated comments for import and from_paths

This commit is contained in:
Joe Ling - uni laptop 2020-07-13 18:53:53 +01:00
parent ec5ab05330
commit 5c20c00d6d
2 changed files with 12 additions and 2 deletions

View File

@ -143,6 +143,16 @@ pub fn from_path(p: &str) -> Result<String> {
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<grass::Error>> {
/// 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"))]

View File

@ -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)
/// <https://sass-lang.com/documentation/at-rules/import#finding-the-file>
/// <https://sass-lang.com/documentation/at-rules/import#load-paths>
fn find_import(file_path: &PathBuf, name: &OsStr, load_paths: &[&Path]) -> Option<PathBuf> {
let paths = [
file_path.with_file_name(name).with_extension("scss"),