Skip to content

alias rsx*! macros to html*! macros and add file support#185

Merged
vidhanio merged 2 commits into
vidhanio:mainfrom
thefiddler:feature/html-macro
Mar 10, 2026
Merged

alias rsx*! macros to html*! macros and add file support#185
vidhanio merged 2 commits into
vidhanio:mainfrom
thefiddler:feature/html-macro

Conversation

@thefiddler

@thefiddler thefiddler commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

This PR builds on #184 and adds html!, html_borrow!, html_file! and html_file_borrow! aliases to the corresponding rsx! macros. Using the html! alias instead of rsx! fixes subsecond hotpatching (re #123) - the underlying issue is that dioxus-cli searches for rsx! by name and special-cases them, which doesn't work in our case.

I have also added a subsecond example that you can try out:

cargo install dioxus-cli
dx serve --hotpatch -p hotpatch

@vidhanio let me know if this workaround makes sense upstream or if you would prefer a feature flag for it. This is easy enough to handle downstream, but I suspect a good subsecond hotpatching experience would be appreciated by end users.

Closes #123 #148

@thefiddler
thefiddler force-pushed the feature/html-macro branch from effe952 to b11b336 Compare March 6, 2026 07:20
@vidhanio

vidhanio commented Mar 6, 2026

Copy link
Copy Markdown
Owner

thank you @thefiddler! i'm so sorry but i've just merged a big refactor i've had sitting on the backburner. it hopefully shouldn't change too much for this PR or your other. would you be okay with

  1. combining both of these PRs/change them for the new structure
  2. wait until Using builder for component instantiation #183 is added to avoid conflicts

@vidhanio vidhanio linked an issue Mar 7, 2026 that may be closed by this pull request
@thefiddler

Copy link
Copy Markdown
Contributor Author

Hi @vidhanio , no worries, I will merge the two PRs in one and rebase as soon as #183 is merged.

- rsx_file! / rsx_file_borrow!: load RSX from external files
- html! / html_borrow! / html_file! / html_file_borrow!: rsx aliases
  that avoid Dioxus CLI name collision
- File paths resolve relative to CARGO_MANIFEST_DIR
- include_bytes! emitted for automatic recompilation on file changes
- Rebased on upstream/main (includes vidhanio#183 builder refactor)
@thefiddler
thefiddler force-pushed the feature/html-macro branch from b11b336 to 7633314 Compare March 8, 2026 21:55
@thefiddler

Copy link
Copy Markdown
Contributor Author

@vidhanio done, I merged both PRs in one and rebased on master.

Let me know if you'd like any changes!

@vidhanio

Copy link
Copy Markdown
Owner

looks great, thank you! it makes sense with the explanation and everything.

@vidhanio vidhanio changed the title alias rsx*! macros to html*! macros alias rsx*! macros to html*! macros and add file support Mar 10, 2026
@vidhanio
vidhanio merged commit e71f55e into vidhanio:main Mar 10, 2026
14 of 15 checks passed
@github-actions github-actions Bot mentioned this pull request Mar 10, 2026
@thefiddler
thefiddler deleted the feature/html-macro branch March 19, 2026 23:11
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.

Hot-reload support

3 participants