Browse Source

docs: commit docs

YuKun Liu 3 years ago
parent
commit
9301a55abf
3 changed files with 78 additions and 1 deletions
  1. 3 1
      docs/cli/src/SUMMARY.md
  2. 18 0
      docs/cli/src/cmd/clean.md
  3. 57 0
      docs/cli/src/cmd/translate.md

+ 3 - 1
docs/cli/src/SUMMARY.md

@@ -6,4 +6,6 @@
 - [Configure Project](./configure.md)
 - [Commands](./cmd/README.md)
   - [Build](./cmd/build.md)
-  - [Serve](./cmd/serve.md)
+  - [Serve](./cmd/serve.md)
+  - [Clean](./cmd/clean.md)
+  - [Translate](./cmd/translate.md)

+ 18 - 0
docs/cli/src/cmd/clean.md

@@ -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
+```
+

+ 57 - 0
docs/cli/src/cmd/translate.md

@@ -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"
+            }
+        }
+    })
+}
+```