oak-scss 0.0.7

SCSS CSS preprocessor language parser with support for modern CSS features and dynamic styling.
Documentation

๐Ÿš€ Oak SCSS Parser

Crates.io Documentation

Modern Styling, Industrial Performance โ€” A high-performance, incremental SCSS parser built on the Oak framework. Designed for building next-generation CSS tools, IDEs, and static analyzers for the modern web.

๐ŸŽฏ Project Vision

SCSS is the cornerstone of modern web styling, enabling complex design systems through its powerful syntax. oak-scss aims to provide a robust, Rust-powered infrastructure for parsing SCSS that is both accurate and incredibly fast. By leveraging Oak's incremental parsing architecture, we enable the creation of highly responsive tools that can handle massive stylesheets with ease. Whether you are building a custom linter, a CSS-in-JS generator, or an advanced IDE extension, oak-scss provides the high-fidelity AST and sub-millisecond performance required to keep up with the evolving CSS ecosystem.

โœจ Core Features

  • โšก Blazing Fast: Engineered in Rust to deliver sub-millisecond parsing response times, even for complex SCSS files with deep nesting and multiple imports.
  • ๐Ÿ”„ Incremental by Design: Built-in support for partial updatesโ€”re-parse only the sections of the stylesheet that changed. Essential for providing real-time feedback in large-scale styling projects.
  • ๐ŸŒณ High-Fidelity AST: Generates a comprehensive and precise Abstract Syntax Tree capturing the full depth of SCSS:
    • Variables & Interpolation: Accurate mapping of variable declarations and their usage in selectors or values.
    • Mixins & Functions: Deep support for mixin definitions, includes, and custom function logic.
    • Control Directives: Precise tracking of @if, @for, @each, and @while blocks.
    • Nesting & Parent Selectors: Robust handling of CSS nesting and the & operator.
    • Comments & Trivia: Retains all trivia (whitespace and comments), enabling faithful round-trip processing and refactoring.
  • ๐Ÿ›ก๏ธ Industrial-Grade Fault Tolerance: Gracefully recovers from syntax errors during active development, providing clear and actionable diagnostics.
  • ๐Ÿงฉ Deep Ecosystem Integration: Seamlessly works with oak-lsp for full LSP support and oak-mcp for intelligent style discovery.

๐Ÿ—๏ธ Architecture

The parser follows the Green/Red Tree architecture (inspired by Roslyn), which allows for:

  1. Efficient Immutability: Share nodes across different versions of the tree without copying.
  2. Lossless Syntax Trees: Retains all trivia (whitespace and comments), enabling faithful code formatting and refactoring.
  3. Type Safety: Strongly-typed "Red" nodes provide a convenient and safe API for tree traversal and analysis.

๐Ÿ› ๏ธ Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.