Skip to content

Commit

Permalink
Add sample/watch.sh and document it in the codelab-4-codelab sample (…
Browse files Browse the repository at this point in the history
…pending #881)
  • Loading branch information
vorburger committed Oct 29, 2023
1 parent 9f2b585 commit ff5cbb3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sample/codelab.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ $ claat serve
* Choose the directory that matches your "id" that you put in the headers.
* Viola! You should have your first codelab!

For a "tight inner loop" while writing Codelabs, you can use a tool like e.g. [`entr`](https://github.com/eradman/entr)
with a [watch script such as this one](https://github.com/googlecodelabs/tools/blob/main/sample/watch.sh); this allows
to change your Markdown source file, Ctrl-S to Save it, F5 to reload in the brower - without having to constantly retype
the commands above every time.

## Host Your CodeLab
Duration: 0:01:00

Expand Down
10 changes: 10 additions & 0 deletions sample/watch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -euo pipefail

# TODO Implement https://github.com/googlecodelabs/tools/issues/881 and remove this! ;-)

../claat/bin/claat serve &
claatServePID=$?
trap 'kill ${claatServePID}' EXIT

echo codelab.md | entr ../claat/bin/claat export codelab.md

0 comments on commit ff5cbb3

Please sign in to comment.