mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-12-18 00:23:07 +00:00
docs: add cli
docs
This commit is contained in:
parent
6ca0a0a4f9
commit
ac808d31ad
3 changed files with 71 additions and 1 deletions
|
@ -2,3 +2,5 @@
|
|||
|
||||
- [Introduction](./introduction.md)
|
||||
- [Installation](./installation.md)
|
||||
- [Create a Project](./creating.md)
|
||||
- [Configure Project](./configure.md)
|
30
docs/cli/src/configure.md
Normal file
30
docs/cli/src/configure.md
Normal file
|
@ -0,0 +1,30 @@
|
|||
# Configure Project
|
||||
|
||||
This chapter will introduce `Dioxus.toml` and anatomy the config file.
|
||||
|
||||
## Structure
|
||||
|
||||
We use `toml` to define some info for `dioxus` project.
|
||||
|
||||
### Application
|
||||
|
||||
1. ***name*** - project name & title
|
||||
2. ***default_platform*** - which platform target for this project.
|
||||
```
|
||||
# current support: web, desktop
|
||||
# default: web
|
||||
default_platform = "web"
|
||||
```
|
||||
change this to `desktop`, the `dioxus build & serve` will default build desktop app.
|
||||
3. ***out_dir*** - which directory to put the output file; use `dioxus build & service`, the output will put at this directory, and the `assets` will be also copy to here.
|
||||
```
|
||||
out_dir = "dist"
|
||||
```
|
||||
4. ***asset_dir*** - which direcotry to put your `static, assets` file, cli will automatic copy all file to `out_dir`, so you can put some resource file in there, like `CSS, JS, Image` file.
|
||||
```
|
||||
asset_dir = "public"
|
||||
```
|
||||
|
||||
### Web.App
|
||||
|
||||
1. ***title*** - this value will display on the web page title. like `<title></title>` tag.
|
38
docs/cli/src/creating.md
Normal file
38
docs/cli/src/creating.md
Normal file
|
@ -0,0 +1,38 @@
|
|||
# Create a Project
|
||||
|
||||
Once you have the Dioxus CLI tool installed, you can use it to create dioxus project.
|
||||
|
||||
## Initializing a default project
|
||||
|
||||
The `dioxus create` command will create a new directory containing a project template.
|
||||
```
|
||||
dioxus create hello-dioxus
|
||||
```
|
||||
|
||||
It will clone a default template from github template: [DioxusLabs/dioxus-template](https://github.com/DioxusLabs/dioxus-template)
|
||||
|
||||
> This default template is use for `web` platform application.
|
||||
|
||||
then you can change the current directory in to the project:
|
||||
|
||||
```
|
||||
cd hello-dioxus
|
||||
```
|
||||
|
||||
> Make sure `wasm32 target` is installed before running the Web project.
|
||||
|
||||
now we can create a `dev server` to display the project:
|
||||
|
||||
```
|
||||
dioxus serve
|
||||
```
|
||||
|
||||
by default, the dioxus dev server will running at: [`http://127.0.0.1:8080/`](http://127.0.0.1:8080/)
|
||||
|
||||
## Initalizing from other repository
|
||||
|
||||
you can assign which repository you want to create:
|
||||
|
||||
```
|
||||
dioxus init hello-dioxus --template=gh:dioxuslabs/dioxus-template
|
||||
```
|
Loading…
Reference in a new issue