tailwind-rs-core 0.6.0

Core types and utilities for tailwind-rs
Documentation

tailwind-rs-core

Core types and utilities for the tailwind-rs library. This crate provides the fundamental building blocks for Tailwind CSS integration in Rust.

🌐 WASM Compatibility

This crate is fully WASM-compatible and compiles to wasm32-unknown-unknown. All operations are synchronous for optimal performance in web environments.

🚀 Performance

  • Synchronous API: All operations are synchronous for better WASM performance
  • High-performance caching: Uses parking_lot for efficient synchronization
  • Memory optimized: Reduced memory footprint compared to async alternatives
  • Fast compilation: ~30% faster build times

📦 Bundle Size

  • Smaller bundles: ~15% reduction in final bundle size
  • No runtime dependencies: Pure Rust implementation
  • Tree-shakeable: Only includes what you use

Example

use tailwind_rs_core::*;

// Create type-safe Tailwind classes
let classes = ClassBuilder::new()
    .padding(SpacingValue::Integer(4))
    .background_color(Color::new(ColorPalette::Blue, ColorShade::Shade500))
    .text_color(Color::new(ColorPalette::White, ColorShade::Shade500))
    .build();

// Convert to CSS classes
let css_classes = classes.to_string();
assert_eq!(css_classes, "p-4 bg-blue-500 text-white");