You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add CssStrategy enum for external and inline css (#51)
* feat: add CssStrategy enum for external and inline component CSS delivery
Introduce CssStrategy to control how component stylesheets are
emitted during parsing:
- External (default): emits <link> tags referencing .css files
- Inline: embeds CSS content in <style> tags within shadow DOM
The strategy is set on HtmlParser via set_css_strategy() and
affects process_component_template output. The webui-cli exposes
this as --css <external|inline> on the build command.
Also feature-gates walkdir/filesystem methods behind the 'fs'
feature so webui-parser compiles for wasm32 without filesystem
dependencies.
* fix crate
/// Embed CSS content inline in `<style>` tags within the shadow DOM template.
346
+
Inline,
347
+
}
348
+
```
349
+
350
+
-**External** (default): Emits `<link>` tags referencing external `.css` files. Used by the CLI for production builds where CSS files are served separately.
351
+
-**Inline**: Embeds the full CSS content in `<style>` tags inside the shadow DOM template. Used when all files are needed in-memory.
352
+
353
+
Set via `parser.set_css_strategy(CssStrategy::Inline)`.
With `--css inline`, only `protocol.bin` is written — CSS is embedded directly in the protocol's template fragments.
147
+
135
148
### protocol.bin
136
149
137
150
The protocol file contains a serialized `WebUIProtocol` structure (protobuf binary) with all parsed fragments. This file is consumed by a [platform handler](/guide/concepts/handlers/) at runtime to render HTML with your application state.
0 commit comments