docs: commit docs

This commit is contained in:
YuKun Liu 2022-02-22 19:21:23 +08:00
parent 9fb5019929
commit 9301a55abf
3 changed files with 78 additions and 1 deletions

View file

@ -7,3 +7,5 @@
- [Commands](./cmd/README.md) - [Commands](./cmd/README.md)
- [Build](./cmd/build.md) - [Build](./cmd/build.md)
- [Serve](./cmd/serve.md) - [Serve](./cmd/serve.md)
- [Clean](./cmd/clean.md)
- [Translate](./cmd/translate.md)

18
docs/cli/src/cmd/clean.md Normal file
View file

@ -0,0 +1,18 @@
# Clean
`dioxus clean` will call `target clean` and remove `out_dir` directory.
```
dioxus-clean
Clean output artifacts
USAGE:
dioxus clean
```
you can use this command to clean all build cache and the `out_dir` content.
```
dioxus clean
```

View file

@ -0,0 +1,57 @@
# Translate
`dioxus translate` can translate some source file into Dioxus code.
```
dioxus-translate
Translate some source file into Dioxus code
USAGE:
dioxus translate [OPTIONS] [OUTPUT]
ARGS:
<OUTPUT> Output file, stdout if not present
OPTIONS:
-c, --component Activate debug mode
-f, --file <FILE> Input file
```
## Translate HTML to stdout
```
dioxus transtale --file ./index.html
```
## Output in a file
```
dioxus translate --component --file ./index.html component.rsx
```
set `component` flag will wrap `dioxus rsx` code in a component function.
## Example
```html
<div>
<h1> Hello World </h1>
<a href="https://dioxuslabs.com/">Link</a>
</div>
```
Translate HTML to Dioxus component code.
```rust
fn component(cx: Scope) -> Element {
cx.render(rsx! {
div {
h1 { "Hello World" },
a {
href: "https://dioxuslabs.com/",
"Link"
}
}
})
}
```