pub struct Compiler { /* private fields */ }
Expand description
CSS Modules compiler.
Intended to be used inside build script.
§Example:
// build.rs
fn main() {
css_mod::Compiler::new()
.add_modules("src/**/*.css").unwrap()
.compile("assets/app.css").unwrap();
}
Implementations§
Source§impl Compiler
impl Compiler
pub fn new() -> Self
Sourcepub fn add_module(&mut self, path: &str) -> Result<&mut Self>
pub fn add_module(&mut self, path: &str) -> Result<&mut Self>
Adds CSS module to compile.
Arguments:
path
: File path, which may be absolute or relative to package root directory.
Sourcepub fn add_modules(&mut self, pattern: &str) -> Result<&mut Self>
pub fn add_modules(&mut self, pattern: &str) -> Result<&mut Self>
Adds CSS modules to compile.
Arguments:
pattern
: Glob pattern, which may be absolute or relative to package root directory.
Sourcepub fn compile(&self, css_bundle_path: &str) -> Result<()>
pub fn compile(&self, css_bundle_path: &str) -> Result<()>
Parses and transforms input CSS modules.
Generates CSS bundle file ready to be included on a HTML page, and rust code file with name
mappings ready to be included into rust project with css_mod::init!
.
Arguments:
css_bundle_path
: File path for output CSS bundle, which may be absolute or relative to package root directory.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Compiler
impl RefUnwindSafe for Compiler
impl Send for Compiler
impl Sync for Compiler
impl Unpin for Compiler
impl UnwindSafe for Compiler
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