1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! Compile-time SCSS embedding via the [`scss!`](crate::scss) macro
//! (requires the `scss` feature).
//!
//! The `.scss` source is `include_str!`-ed into the binary at build time;
//! [`grass`] compiles it to CSS on first access (lazily, cached in a
//! `LazyLock`). The resulting rules carry
//! [`Origin::Theme`](crate::Origin::Theme) — the same override semantics as
//! [`css!`](crate::css).
//!
//! `grass` is re-exported as [`crate::grass`], so the `scss!` macro resolves in
//! downstream crates without them adding `grass` as a direct dependency.
//!
//! ```rust,ignore
//! use std::sync::LazyLock;
//! use ratatui_style::{OwnedNode, scss, Stylesheet};
//!
//! static THEME: LazyLock<Stylesheet> = scss!("theme.scss");
//!
//! fn main() {
//! let node = OwnedNode::new("Button").with_classes(["primary"]);
//! let computed = THEME.compute(&node, None); // auto-deref through LazyLock
//! }
//! ```
/// Embed a `.scss` file at compile time and lazily compile it to a
/// [`std::sync::LazyLock<Stylesheet>`](crate::Stylesheet).
///
/// Requires the `scss` feature. The path is resolved relative to the source
/// file where the macro is invoked (via `include_str!`). The SCSS source is
/// embedded at build time; `grass` compiles it to CSS on first access. Rules
/// are tagged [`Origin::Theme`](crate::Origin::Theme), making them overridable
/// by user-level rules at runtime (see [`RuntimeStyle`](crate::RuntimeStyle)).
///
/// Bind the result to a `static`, just like [`css!`](crate::css).
///
/// # Panics
///
/// Panics on first access if the SCSS fails to compile or the resulting CSS
/// fails to parse. Since the source is fixed at compile time, this indicates a
/// bug in the `.scss` file.