pub struct Options<'a> { /* private fields */ }
Expand description
Configuration for Sass compilation
The simplest usage is grass::Options::default()
; however, a builder pattern
is also exposed to offer more control.
Implementations§
source§impl<'a> Options<'a>
impl<'a> Options<'a>
sourcepub fn logger(self, logger: &'a dyn Logger) -> Options<'a>
pub fn logger(self, logger: &'a dyn Logger) -> Options<'a>
This option allows you to define how log events should be handled
Be default, StdLogger
is used, which writes all events to standard output.
sourcepub const fn style(self, style: OutputStyle) -> Options<'a>
pub const fn style(self, style: OutputStyle) -> Options<'a>
grass
currently offers 2 different output styles
OutputStyle::Expanded
writes each selector and declaration on its own line.OutputStyle::Compressed
removes as many extra characters as possible and writes the entire stylesheet on a single line.
By default, output is expanded.
sourcepub const fn quiet(self, quiet: bool) -> Options<'a>
pub const fn quiet(self, quiet: bool) -> Options<'a>
This flag tells Sass not to emit any warnings when compiling. By default,
Sass emits warnings when deprecated features are used or when the @warn
rule is encountered. It also silences the @debug
rule.
Setting this option to true
will stop all logs from reaching the crate::Logger
.
By default, this value is false
and warnings are emitted.
sourcepub fn load_path<P>(self, path: P) -> Options<'a>
pub fn load_path<P>(self, path: P) -> Options<'a>
All Sass implementations allow users to provide load paths: paths on the
filesystem that Sass will look in when locating modules. For example, if
you pass node_modules/susy/sass
as a load path, you can use
@import "susy"
to load node_modules/susy/sass/susy.scss
.
Imports will always be resolved relative to the current file first, though. Load paths will only be used if no relative file exists that matches the module’s URL. This ensures that you can’t accidentally mess up your relative imports when you add a new library.
This method will append a single path to the list.
sourcepub fn load_paths<P>(self, paths: &[P]) -> Options<'a>
pub fn load_paths<P>(self, paths: &[P]) -> Options<'a>
Append multiple loads paths
Note that this method does not remove existing load paths
See Options::load_path
for more information about
load paths
sourcepub const fn allows_charset(self, allows_charset: bool) -> Options<'a>
pub const fn allows_charset(self, allows_charset: bool) -> Options<'a>
This flag tells Sass whether to emit a @charset
declaration or a UTF-8 byte-order mark.
By default, Sass will insert either a @charset
declaration (in expanded output mode) or a byte-order
mark (in compressed output mode) if the stylesheet
contains any non-ASCII characters.
sourcepub const fn unicode_error_messages(
self,
unicode_error_messages: bool
) -> Options<'a>
pub const fn unicode_error_messages( self, unicode_error_messages: bool ) -> Options<'a>
This flag tells Sass only to emit ASCII characters as part of error messages.
By default Sass will emit non-ASCII characters for these messages.
This flag does not affect the CSS output.
sourcepub const fn input_syntax(self, syntax: InputSyntax) -> Options<'a>
pub const fn input_syntax(self, syntax: InputSyntax) -> Options<'a>
This option forces Sass to parse input using the given syntax.
By default, Sass will attempt to read the file extension to determine
the syntax. If this is not possible, it will default to InputSyntax::Scss
.
This flag only affects the first file loaded. Files that are loaded using
@import
, @use
, or @forward
will always have their syntax inferred.