pub struct SassTransformer {
pub options: Options,
}Available on crate feature
sass only.Expand description
A Transformer that compiles SASS/SCSS files to CSS.
Files whose names begin with _ are treated as partials and skipped (not emitted
to the dist directory). All other .sass and .scss files are compiled to .css.
Non-SASS files are not claimed and fall through to the default plain-copy behaviour.
Add this transformer to Dist to enable SASS/SCSS compilation:
use xtask_wasm::{anyhow::Result, clap, SassTransformer};
#[derive(clap::Parser)]
enum Opt {
Dist(xtask_wasm::Dist),
}
fn main() -> Result<()> {
let opt: Opt = clap::Parser::parse();
match opt {
Opt::Dist(dist) => {
dist.transformer(SassTransformer::default())
.build("my-project")?;
}
}
Ok(())
}To customise the compilation options, construct SassTransformer directly:
use xtask_wasm::{anyhow::Result, clap, SassTransformer};
#[derive(clap::Parser)]
enum Opt {
Dist(xtask_wasm::Dist),
}
fn main() -> Result<()> {
let opt: Opt = clap::Parser::parse();
match opt {
Opt::Dist(dist) => {
dist.transformer(SassTransformer {
options: sass_rs::Options {
output_style: sass_rs::OutputStyle::Compressed,
..Default::default()
},
})
.build("my-project")?;
}
}
Ok(())
}Fields§
§options: OptionsOptions forwarded to sass_rs::compile_file.
Trait Implementations§
Source§impl Debug for SassTransformer
Available on non-WebAssembly only.
impl Debug for SassTransformer
Available on non-WebAssembly only.
Source§impl Default for SassTransformer
Available on non-WebAssembly only.
impl Default for SassTransformer
Available on non-WebAssembly only.
Source§fn default() -> SassTransformer
fn default() -> SassTransformer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SassTransformer
impl RefUnwindSafe for SassTransformer
impl Send for SassTransformer
impl Sync for SassTransformer
impl Unpin for SassTransformer
impl UnsafeUnpin for SassTransformer
impl UnwindSafe for SassTransformer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more