Skip to content

feat: add configurable CSS asset names#313

Merged
mohamedmansour merged 4 commits into
mainfrom
feat/chunk-names
May 27, 2026
Merged

feat: add configurable CSS asset names#313
mohamedmansour merged 4 commits into
mainfrom
feat/chunk-names

Conversation

@mohamedmansour
Copy link
Copy Markdown
Contributor

@mohamedmansour mohamedmansour commented May 27, 2026

Summary

  • Add Link-mode CSS file name templating with [name], [hash], and [ext] tokens, defaulting to [name].[ext].
  • Add optional CSS public base support so generated stylesheet hrefs can target CDN/public asset roots while local CSS files still write to the build output.
  • Move CSS link href resolution into webui-parser, share cached resolution across parser/build consumers, and keep parser construction ergonomic with ParserOptions.
  • Expose the options through Rust, CLI, Node native bindings, the TypeScript package API, and docs.

Documentation

  • Updated DESIGN.md, CLI docs, Rust/Node integration docs, docs/ai.md, crate READMEs, and package README.

Validation

  • pnpm --filter @microsoft/webui build
  • cargo xtask check
  • Security review: no high-confidence vulnerabilities found

Fixes #310
Fixes #311

mohamedmansour and others added 2 commits May 27, 2026 01:58
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds configurable Link-mode CSS asset naming (including content-hash support) and an optional public base prefix for emitted stylesheet hrefs, threading the configuration across the Rust core, CLI, Node bindings/TS API, and documentation.

Changes:

  • Introduces Link-mode CSS filename templating ([name], [hash], [ext]) and css_public_base for CDN/public URL prefixing.
  • Moves CSS link href/filename resolution into webui-parser (CssLinkOptions / ParserOptions) and re-plumbs parser/plugin construction to use options at creation time.
  • Exposes the new options via Rust BuildOptions, CLI flags, Node native bindings, the TS package API, and updates docs/spec.

Reviewed changes

Copilot reviewed 31 out of 32 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
packages/webui/src/index.ts Adds JS API options and CLI fallback flags for CSS template/public base.
packages/webui/README.md Documents new JS build options.
examples/demo/server/src/shell.rs Updates example to use BuildOptions::default() struct update pattern.
examples/app/commerce/server/src/frontend.rs Updates example construction to use defaults + overrides.
docs/guide/integrations/rust.md Documents new Rust build options.
docs/guide/integrations/node.md Documents new Node build options.
docs/guide/cli/index.md Documents new CLI flags + guidance for hashing/CDN base.
docs/ai.md Updates AI-facing CLI reference for new flags.
DESIGN.md Updates spec for Link-mode CSS href behavior and parser options construction.
crates/webui/src/lib.rs Adds new build options defaults, integrates ParserOptions, resolves CSS href/filenames, adds tests.
crates/webui/src/error.rs Adds InvalidBuildOptions error variant.
crates/webui/README.md Documents new Rust build options and recommended CDN/hash usage.
crates/webui/examples/streaming_resource_bench.rs Updates to new BuildOptions::default() pattern.
crates/webui/examples/streaming_e2e_ttfb_bench.rs Updates to new BuildOptions::default() pattern.
crates/webui/benches/streaming_bench.rs Updates to new BuildOptions::default() pattern.
crates/webui/benches/contact_book_bench.rs Updates to new BuildOptions::default() pattern.
crates/webui-wasm/src/lib.rs Switches to HtmlParser::with_options(...) API.
crates/webui-press/src/build.rs Updates builder construction to use defaults + overrides.
crates/webui-parser/src/plugin/webui.rs Moves plugin configuration to configure(&ParserOptions).
crates/webui-parser/src/plugin/mod.rs Adds ParserPlugin::configure hook.
crates/webui-parser/src/plugin/fast_v3.rs Uses processed templates for consistent CSS links; adds css-link-aware generation helper.
crates/webui-parser/src/plugin/fast_v2.rs Same as fast_v3 changes for FAST v2.
crates/webui-parser/src/lib.rs Introduces ParserOptions and new parser constructors; updates template processing to use options.
crates/webui-parser/src/css_link.rs New module implementing template + public-base resolution and caching.
crates/webui-parser/Cargo.toml Adds sha2 dependency for content hashing.
crates/webui-parser/benches/parser_bench.rs Updates bench to new parser construction API.
crates/webui-node/src/lib.rs Exposes new options through N-API bindings.
crates/webui-cli/src/commands/serve.rs Updates CLI tests/config to include new build options fields.
crates/webui-cli/src/commands/common.rs Adds CLI flags, wiring into BuildOptions, and a unit test.
crates/webui-cli/src/commands/build.rs Updates CLI build command wiring/tests to include new fields.
crates/webui-cli/README.md Documents new CLI flags and examples.
Cargo.lock Bumps workspace crate versions and adds sha2 to webui-parser deps.

Comment thread crates/webui-parser/src/css_link.rs Outdated
Comment thread crates/webui-parser/src/css_link.rs
Comment thread crates/webui/src/lib.rs Outdated
Comment thread crates/webui-parser/src/plugin/fast_v3.rs
Comment thread crates/webui-parser/src/plugin/fast_v2.rs
Comment thread crates/webui-parser/src/css_link.rs
mohamedmansour and others added 2 commits May 27, 2026 08:33
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mohamedmansour mohamedmansour merged commit b02af48 into main May 27, 2026
21 checks passed
@mohamedmansour mohamedmansour deleted the feat/chunk-names branch May 27, 2026 16:57
Copilot AI added a commit that referenced this pull request May 27, 2026
Clustered changes since v0.0.13:

1) CSS asset naming + parser pipeline (#313)

- Added configurable CSS asset names across parser plugins and runtime integration paths.

- Introduced dedicated CSS link handling in the parser with broader coverage in benches/examples.

- Updated CLI, Node, Rust, and docs surfaces to expose and document the new behavior.

2) Custom protocol output path in CLI/FFI (#314)

- Added support for writing protocol output with --out=<path>.bin in the build command flow.

- Updated CLI docs and FFI headers so generated protocol output can be redirected predictably.

3) Release alignment for 0.0.14

- Ran cargo xtask version 0.0.14 to synchronize crate/npm/.NET version metadata.

- Regenerated dependency lock state as part of the release bump workflow.
mohamedmansour pushed a commit that referenced this pull request May 27, 2026
* Progress: ran version bump and release checks

* chore(release): summarize 0.0.14 changes

Clustered changes since v0.0.13:

1) CSS asset naming + parser pipeline (#313)

- Added configurable CSS asset names across parser plugins and runtime integration paths.

- Introduced dedicated CSS link handling in the parser with broader coverage in benches/examples.

- Updated CLI, Node, Rust, and docs surfaces to expose and document the new behavior.

2) Custom protocol output path in CLI/FFI (#314)

- Added support for writing protocol output with --out=<path>.bin in the build command flow.

- Updated CLI docs and FFI headers so generated protocol output can be redirected predictably.

3) Release alignment for 0.0.14

- Ran cargo xtask version 0.0.14 to synchronize crate/npm/.NET version metadata.

- Regenerated dependency lock state as part of the release bump workflow.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CSS CDN prefix option for --css=link CSS content-hashed filenames

3 participants