Skip to content

Commit d9eef4d

Browse files
committed
veb: update the section describing -d veb_livereload
1 parent d4b35eb commit d9eef4d

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎vlib/veb/README.md‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ Now modifying any file in your web app (whether it's a .v file with the backend
2020
or a compiled .html template file) will result in an instant refresh of your app
2121
in the browser. No need to quit the app, rebuild it, and refresh the page in the browser!
2222

23+
Note: this works by injecting a small `<script>` tag before the ending `</html>` tag of the page,
24+
that will check periodically if the current page has to be reloaded. In other words, it works for
25+
template pages that have that `</html>` tag, or for ones that were produced by `ctx.html()` and that
26+
also have that closing tag, but not for ones produced by `ctx.text()` .
27+
2328
## Deploying veb apps
2429

2530
All the code, including HTML templates, is in one binary file. That's all you need to deploy.
@@ -63,7 +68,7 @@ pub:
6368
6469
// This is how endpoints are defined in veb. This is the index route
6570
pub fn (app &App) index(mut ctx Context) veb.Result {
66-
return ctx.text('Hello V! The secret key is "${app.secret_key}"')
71+
return ctx.html('<html><body><h1>Hello V!</h1><p>The secret key is "${app.secret_key}"</body></html>')
6772
}
6873
6974
fn main() {

0 commit comments

Comments
 (0)