Skip to content

Commit ff5cbb3

Browse files
committed
Add sample/watch.sh and document it in the codelab-4-codelab sample (pending #881)
1 parent 9f2b585 commit ff5cbb3

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

sample/codelab.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,11 @@ $ claat serve
202202
* Choose the directory that matches your "id" that you put in the headers.
203203
* Viola! You should have your first codelab!
204204

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

sample/watch.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# TODO Implement https://github.com/googlecodelabs/tools/issues/881 and remove this! ;-)
5+
6+
../claat/bin/claat serve &
7+
claatServePID=$?
8+
trap 'kill ${claatServePID}' EXIT
9+
10+
echo codelab.md | entr ../claat/bin/claat export codelab.md

0 commit comments

Comments
 (0)