fix include_sass test
This commit is contained in:
parent
16ad7298fe
commit
d7962e02be
@ -124,11 +124,9 @@ impl ListSeparator {
|
||||
}
|
||||
}
|
||||
|
||||
/// In Sass, underscores and hyphens are considered equal
|
||||
/// when inside identifiers.
|
||||
/// In Sass, underscores and hyphens are considered equal when inside identifiers.
|
||||
///
|
||||
/// This struct protects that invariant by normalizing all
|
||||
/// underscores into hypens.
|
||||
/// This struct protects that invariant by normalizing all underscores into hypens.
|
||||
#[derive(Clone, Eq, PartialEq, Hash, PartialOrd, Ord, Copy)]
|
||||
pub(crate) struct Identifier(InternedString);
|
||||
|
||||
|
@ -183,15 +183,14 @@ fn from_string_with_file_name<P: AsRef<Path>>(
|
||||
|
||||
/// Compile CSS from a path
|
||||
///
|
||||
/// n.b. grass does not currently support files or paths that are not valid UTF-8
|
||||
/// n.b. `grass` does not currently support files or paths that are not valid UTF-8
|
||||
///
|
||||
/// ```
|
||||
/// fn main() -> Result<(), Box<grass::Error>> {
|
||||
/// let sass = grass::from_path("input.scss", &grass::Options::default())?;
|
||||
/// let css = grass::from_path("input.scss", &grass::Options::default())?;
|
||||
/// Ok(())
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
#[inline]
|
||||
pub fn from_path<P: AsRef<Path>>(p: P, options: &Options) -> Result<String> {
|
||||
from_string_with_file_name(String::from_utf8(options.fs.read(p.as_ref())?)?, p, options)
|
||||
@ -201,12 +200,11 @@ pub fn from_path<P: AsRef<Path>>(p: P, options: &Options) -> Result<String> {
|
||||
///
|
||||
/// ```
|
||||
/// fn main() -> Result<(), Box<grass::Error>> {
|
||||
/// let sass = grass::from_string("a { b { color: &; } }".to_string(), &grass::Options::default())?;
|
||||
/// assert_eq!(sass, "a b {\n color: a b;\n}\n");
|
||||
/// let css = grass::from_string("a { b { color: &; } }".to_string(), &grass::Options::default())?;
|
||||
/// assert_eq!(css, "a b {\n color: a b;\n}\n");
|
||||
/// Ok(())
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
#[inline]
|
||||
pub fn from_string(input: String, options: &Options) -> Result<String> {
|
||||
from_string_with_file_name(input, "stdin", options)
|
||||
|
@ -4,9 +4,8 @@ use crate::{Fs, StdFs};
|
||||
|
||||
/// Configuration for Sass compilation
|
||||
///
|
||||
/// The simplest usage is `grass::Options::default()`;
|
||||
/// however, a builder pattern is also exposed to offer
|
||||
/// more control.
|
||||
/// The simplest usage is `grass::Options::default()`; however, a builder pattern
|
||||
/// is also exposed to offer more control.
|
||||
#[derive(Debug)]
|
||||
pub struct Options<'a> {
|
||||
pub(crate) fs: &'a dyn Fs,
|
||||
|
@ -3,5 +3,5 @@
|
||||
fn basic() {
|
||||
let css: &str = grass::include!("./input.scss");
|
||||
|
||||
assert!(css == "a {\n color: red;\n}\n");
|
||||
assert_eq!(css, "a{color:red}");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user