Skip to main content

ferro_json_ui/
assets.rs

1//! Embedded static assets for ferro-json-ui.
2//!
3//! Served by the framework via the automatically-registered
4//! `GET /_ferro/ferro-base.css` route. Embedded at compile time —
5//! no runtime file I/O.
6
7/// Pre-built Tailwind CSS covering every utility class emitted by
8/// ferro-json-ui components.
9///
10/// Regenerate with `scripts/gen-ferro-base-css.sh` after adding or
11/// modifying components that introduce new utility classes.
12pub const FERRO_BASE_CSS: &str = include_str!("../assets/ferro-base.css");
13
14#[cfg(test)]
15mod tests {
16    use super::*;
17
18    #[test]
19    #[allow(clippy::const_is_empty)]
20    fn ferro_base_css_non_empty() {
21        assert!(!FERRO_BASE_CSS.is_empty(), "embedded CSS must not be empty");
22        // include_str! guarantees valid UTF-8 (compile error otherwise),
23        // so runtime validation is unnecessary. Smoke-check a class that
24        // every ferro-json-ui page relies on:
25        assert!(
26            FERRO_BASE_CSS.contains("flex"),
27            "expected `flex` utility in generated CSS"
28        );
29    }
30}