Expand description
This crate provides functionality for compiling Sass to CSS.
This crate targets compatibility with the reference implementation in Dart. If
upgrading from the now deprecated
libsass, one may have to modify their stylesheets. These changes will not differ
from those necessary to upgrade to dart-sass, and in general such changes should
be quite rare.
This crate is capable of compiling Bootstrap 4 and 5, bulma and bulma-scss, Bourbon, as well as most other large Sass libraries with complete accuracy. For the vast majority of use cases there should be no perceptible differences from the reference implementation.
§Use as library
fn main() -> Result<(), Box<accent_sass::Error>> {
let css = accent_sass::from_string(
"a { b { color: &; } }".to_owned(),
&accent_sass::Options::default()
)?;
assert_eq!(css, "a b {\n color: a b;\n}\n");
Ok(())
}§Use as binary
cargo install accent-sass
accent-sass input.scssMacros§
- include
macro - Include CSS in your binary at compile time from a Sass source file
Structs§
- Deprecation
Warning - A warning about a deprecated feature, with where it happened.
- Error
SassErrors can be either a structured error specific toaccent-sassor anio::Error.- Memory
Fs - A
Fsbacked by a map of path to file contents. - NullFs
- A file system implementation that acts like it’s completely empty.
- Null
Logger - Discards all logs
- Options
- Configuration for Sass compilation
- StdFs
- Use
std::fsto read any files from disk. - StdLogger
- Logs events to standard error, through
eprintln!
Enums§
- Deprecation
- A deprecated feature, named the way dart-sass names it.
- Error
Kind - Input
Syntax - Useful when parsing Sass from sources other than the file system
- Output
Style
Traits§
- Fs
- A trait to allow replacing the file system lookup mechanisms.
- Logger
- A trait to allow replacing logging mechanisms
Functions§
- from_
path - Compile CSS from a path
- from_
string - Compile CSS from a string
- from_
string_ with_ file_ name - Compile CSS from a string, as though it were the file at
file_name.