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
sourceimpl 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 include in HTML page, and name mappings rust code ready
to include 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 RefUnwindSafe for Compiler
impl Send for Compiler
impl Sync for Compiler
impl Unpin for Compiler
impl UnwindSafe for Compiler
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more