You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/docs/cli/index.md
+122-2Lines changed: 122 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,7 @@ This tells Composer to install the Leaf CLI globally on your system. You can ver
41
41
leaf --version
42
42
```
43
43
44
-
##[Error] command not found: leaf
44
+
::: details[Error] command not found: leaf
45
45
46
46
If you get an error saying `leaf: command not found`, you need to add Composer's global bin directory to your system's PATH. This directory contains every package installed through `composer global require`. Let's fix this by adding the directory to your PATH.
47
47
@@ -57,7 +57,7 @@ If this command does not work, you can try these common locations:
57
57
- macOS: `$HOME/.composer/vendor/bin`
58
58
- GNU / Linux Distributions: `$HOME/.config/composer/vendor/bin` or `$HOME/.composer/vendor/bin`
59
59
60
-
## Adding to PATH
60
+
**Adding to PATH:**
61
61
62
62
Once you have the location, you can add it to your PATH. On Mac and Linux, you can do this by running these in your terminal:
Besides creating apps, Leaf CLI also helps you manage your apps. This includes things like running your app, dependency management, running commands, and more. This guide covers all such features.
79
+
80
+
## Running your app
81
+
82
+
You can run your app by navigating into your app's directory and running the `leaf serve` command. This will start a development server and serve your app on `localhost:5500`.
83
+
84
+
```bash:no-line-numbers
85
+
cd my-app
86
+
leaf serve
87
+
```
88
+
89
+
You can also specify a port to run your app on by passing the `--port` or `-p` flag:
90
+
91
+
```bash:no-line-numbers
92
+
leaf serve --port=8080
93
+
```
94
+
95
+
The serve command also has a `--watch` flag that watches your app for changes and automatically reloads your app when changes are detected:
96
+
97
+
```bash:no-line-numbers
98
+
leaf serve --watch
99
+
```
100
+
101
+
*Note: The `--watch` flag is only available when running your app in development mode and uses nodejs to watch your app for changes.*
102
+
103
+
If you want to run your application from a different directory, you can pass the path to the directory as an argument:
104
+
105
+
```bash:no-line-numbers
106
+
leaf serve /path/to/your/app
107
+
```
108
+
109
+
::: info Automatic dependency installation
110
+
When running your app, Leaf will automatically try to install missing dependencies if no `vendor` directory is found in your app's directory.
111
+
:::
112
+
113
+
## Running commands
114
+
115
+
Leaf CLI also allows you to run commands in your app's directory. If you have a command in your `composer.json` file, you can run it using the `leaf run` command:
116
+
117
+
```bash:no-line-numbers
118
+
leaf run my-command
119
+
```
120
+
121
+
## Dependency management
122
+
123
+
Leaf CLI also has commands built on top of Composer to help you manage your app's dependencies. Leaf has a whole ecosystem of packages that are treated as first-class citizens in the Leaf ecosystem, and are given special treatment by the CLI. This makes working with Leaf packages a breeze, but also allows you to work with any Composer package.
124
+
125
+
::: details Are you a visual learner?
126
+
127
+
This video will help you understand how to work with packages on the Leaf CLI.
128
+
129
+
<VideoModal
130
+
subject="Working with packages on the Leaf CLI"
131
+
description="Working with packages and the leaf cli"
This works the same way as installing packages, but you use the `uninstall` command instead.
168
+
169
+
```bash:no-line-numbers
170
+
leaf uninstall ui
171
+
leaf uninstall ui db illuminate/support
172
+
```
173
+
174
+
## View commands
175
+
176
+
Leaf CLI also allows you to create and interact with frontend setups using the `view` commands. You can scaffold frontend setups like React, Vue, templating engines, build tools, and more.
177
+
178
+
### Scaffolding views
179
+
180
+
Leaf CLI ships with a `view:install` command that allows you to set up React, Vue, and templating engines like Blade and BareUI. You can use the `--react`, `--vue`, `--blade`, and `--svelte` options to scaffold your frontend setup.
181
+
182
+
```bash:no-line-numbers
183
+
leaf view:install --react
184
+
```
185
+
186
+
You can also use the `--vite` and `--tailwind` options to scaffold Vite and Tailwind respectively.
187
+
188
+
### Building frontend setups
189
+
190
+
You can also use the `view:build` command to build your frontend setup for production.
0 commit comments