Struct grass::Options

source ·
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>

source

pub fn fs(self, fs: &'a (dyn Fs + 'a)) -> Options<'a>

This option allows you to control the file system that Sass will see.

By default, it uses StdFs, which is backed by std::fs, allowing direct, unfettered access to the local file system.

source

pub const fn style(self, style: OutputStyle) -> Options<'a>

grass currently offers 2 different output styles

By default, output is expanded.

source

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.

By default, this value is false and warnings are emitted.

source

pub fn load_path<P>(self, path: P) -> Options<'a>where P: AsRef<Path>,

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.

source

pub fn load_paths<P>(self, paths: &[P]) -> Options<'a>where P: AsRef<Path>,

Append multiple loads paths

Note that this method does not remove existing load paths

See Options::load_path for more information about load paths

source

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.

source

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.

source

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.

Trait Implementations§

source§

impl<'a> Debug for Options<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Default for Options<'_>

source§

fn default() -> Options<'_>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Options<'a>

§

impl<'a> !Send for Options<'a>

§

impl<'a> !Sync for Options<'a>

§

impl<'a> Unpin for Options<'a>

§

impl<'a> !UnwindSafe for Options<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V