generate_css_file

Function generate_css_file 

Source
pub fn generate_css_file(
    output_path: &str,
    classes: Option<&ClassSet>,
) -> Result<()>
Expand description

Generate a CSS file with all necessary Tailwind classes

This function provides the seamless integration between ClassBuilder and CSS generation that was requested in the GitHub issue. It automatically generates a comprehensive CSS file with all the classes that might be used in your application.

§Arguments

  • output_path - The path where the CSS file should be written
  • classes - Optional ClassSet containing classes to include in the CSS

§Examples

use tailwind_rs_core::*;

fn main() -> Result<()> {
    // Generate CSS with specific classes
    let classes = ClassBuilder::new()
        .padding(SpacingValue::Integer(4))
        .class("bg-blue-500")
        .class("text-white")
        .build();
     
    generate_css_file("styles.css", Some(&classes))?;
     
    // Generate comprehensive CSS with all utilities
    generate_css_file("comprehensive.css", None)?;
     
    Ok(())
}