Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Aug 30, 2024
1 parent ea03bbc commit 66132b8
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions docs/guide/devtools.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,39 @@ For instance, the following will run the `textual colors` command:
textual run -c textual colors
```

### Serve

The devtools can also serve your application in a browser.
Effectively turning your terminal app in to a web application!

The `serve` sub-command is similar to `run`. Here's how you can serve an app launched from a Python file:

```
textual serve my_app.py
```

You can also serve a Textual app launched via a command. Here's an example:

```
textual serve "textual keys"
```

The syntax for launching an app in a module is slightly different from `run`.
You need to specify the full command, including `python`.
Here's how you would run the Textual demo:

```
textual serve "python -m textual"
```

Textual's builtin web-server is quite powerful.
You can serve multiple instances of your application at once!

!!! tip

Textual serve is also useful when developing your app.
If you make changes to your code, simply refresh the browser to update.

## Live editing

If you combine the `run` command with the `--dev` switch your app will run in *development mode*.
Expand Down

0 comments on commit 66132b8

Please sign in to comment.