tailwind-rs-postcss 0.15.4

PostCSS integration for Tailwind-RS Core
Documentation
//! CSS Transformer implementation
//!
//! This module provides CSS transformation capabilities for PostCSS integration.

use crate::ast::CSSNode;
use crate::error::Result;
use serde::{Deserialize, Serialize};

/// CSS transformer with configurable options
#[derive(Debug, Clone)]
pub struct CSSTransformer {
    options: TransformOptions,
}

/// Transform configuration options
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TransformOptions {
    /// Enable CSS optimization
    pub optimize: bool,
    /// Enable vendor prefixing
    pub vendor_prefixes: bool,
    /// Enable CSS nesting flattening
    pub flatten_nesting: bool,
    /// Enable CSS custom properties resolution
    pub resolve_custom_properties: bool,
}

impl Default for TransformOptions {
    fn default() -> Self {
        Self {
            optimize: true,
            vendor_prefixes: false,
            flatten_nesting: true,
            resolve_custom_properties: true,
        }
    }
}

impl CSSTransformer {
    /// Create a new CSS transformer
    pub fn new(options: TransformOptions) -> Self {
        Self { options }
    }

    /// Transform CSS AST
    pub fn transform(&self, ast: CSSNode) -> Result<CSSNode> {
        // Basic transformation implementation
        // In a full implementation, this would apply various transformations
        Ok(ast)
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_transformer_creation() {
        let options = TransformOptions::default();
        let transformer = CSSTransformer::new(options);
        assert!(transformer.options.optimize);
    }
}