doc formatting and cleanup
This commit is contained in:
1 parent
351b9fab6f
commit
6b4a300880
2 files changed
+6
-11
No files matched your search
@@ -5,16 +5,13 @@
|
|||||||
3. Currently the cli only implements hot reloading for the web renderer. For TUI, desktop, and LiveView you can use the hot reload macro instead.
|
3. Currently the cli only implements hot reloading for the web renderer. For TUI, desktop, and LiveView you can use the hot reload macro instead.
|
||||||
|
|
||||||
# Web
|
# Web
|
||||||
|
|
||||||
For the web renderer, you can use the dioxus cli to serve your application with hot reloading enabled.
|
For the web renderer, you can use the dioxus cli to serve your application with hot reloading enabled.
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
Install [dioxus-cli](https://github.com/DioxusLabs/cli).
|
Install [dioxus-cli](https://github.com/DioxusLabs/cli).
|
||||||
Hot reloading is automatically enabled when using the web renderer on debug builds.
|
Hot reloading is automatically enabled when using the web renderer on debug builds.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
1. Run:
|
1. Run:
|
||||||
```bash
|
```bash
|
||||||
dioxus serve --hot-reload
|
dioxus serve --hot-reload
|
||||||
@@ -24,12 +21,10 @@ dioxus serve --hot-reload
|
|||||||
4. Save and watch the style change without recompiling
|
4. Save and watch the style change without recompiling
|
||||||
|
|
||||||
# Desktop/Liveview/TUI
|
# Desktop/Liveview/TUI
|
||||||
|
|
||||||
For desktop, LiveView, and tui, you can place the hot reload macro at the top of your main function to enable hot reloading.
|
For desktop, LiveView, and tui, you can place the hot reload macro at the top of your main function to enable hot reloading.
|
||||||
Hot reloading is automatically enabled on debug builds.
|
Hot reloading is automatically enabled on debug builds.
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
Add the following to your main function:
|
Add the following to your main function:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
@@ -48,5 +43,5 @@ cargo run
|
|||||||
3. Save and watch the style change without recompiling
|
3. Save and watch the style change without recompiling
|
||||||
|
|
||||||
# Limitations
|
# Limitations
|
||||||
1. The interpreter can only use expressions that existed on the last full recompile. If you introduce a new variable or expression to the rsx call, it will trigger a full recompile to capture the expression.
|
1. The interpreter can only use expressions that existed on the last full recompile. If you introduce a new variable or expression to the rsx call, it will require a full recompile to capture the expression.
|
||||||
2. Components and Iterators can contain arbitrary rust code and will trigger a full recompile when changed.
|
2. Components, Iterators, and some attributes can contain arbitrary rust code and will trigger a full recompile when changed.
|
||||||
@@ -68,9 +68,9 @@ rsx! {
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
> For hot relaoding with the web renderer, see the [dioxus-cli](https://github.com/DioxusLabs/cli) project.
|
> This crate implements hot reloading for native compilation targets not WASM. For hot relaoding with the web renderer, see the [dioxus-cli](https://github.com/DioxusLabs/cli) project.
|
||||||
|
|
||||||
For renderers that support hot reloading add this to your main function before you launch your app to start the hot reloading server:
|
Add this to the top of your main function on any renderer that supports hot reloading to start the hot reloading server:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
fn main(){
|
fn main(){
|
||||||
@@ -79,7 +79,7 @@ fn main(){
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The dev server watches on the `src` and `examples` folders in the crate directory by default. To watch on custom paths pass the paths into the hot relaod macro:
|
By default the dev server watches on the `src` and `examples` folders in the root crate directory. To watch on custom paths pass the paths into the hot relaod macro:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
fn main(){
|
fn main(){
|
||||||
@@ -108,7 +108,7 @@ fn main(){
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Implementing hot reloading for a custom renderer
|
## Implementing Hot Reloading for a Custom Renderer
|
||||||
|
|
||||||
To add hot reloading support to your custom renderer you can use the connect function. This will connect to the dev server you just need to provide a way to transfer `Template`s to the `VirtualDom`. Once you implement this your users can use the hot_reload_init function just like any other render.
|
To add hot reloading support to your custom renderer you can use the connect function. This will connect to the dev server you just need to provide a way to transfer `Template`s to the `VirtualDom`. Once you implement this your users can use the hot_reload_init function just like any other render.
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user