From 0bae8c01f8e0fdfa67a6ba56d7a3d15f65bf1e1b Mon Sep 17 00:00:00 2001 From: heyarne Date: Thu, 29 Jul 2021 21:45:18 +0200 Subject: [PATCH] Update README about netrepl and make sure we can stop the watch command --- README.md | 15 ++++++++++++--- .../posts}/2021-07-07--let-there-be-light.md | 0 index.janet | 12 +++--------- posts/transclude_text.txt | 1 - 4 files changed, 15 insertions(+), 13 deletions(-) rename {posts => content/posts}/2021-07-07--let-there-be-light.md (100%) delete mode 100644 posts/transclude_text.txt diff --git a/README.md b/README.md index 68729f7..1bb7cb8 100644 --- a/README.md +++ b/README.md @@ -15,14 +15,23 @@ The site itself is built using [bagatto](https://bagatto.co/), which is a static bag index.janet ``` -There is some code that starts a networked repl when you add the `--repl` flag to the above command. This allows you to interactively evaluate parts of the website, which is very handy if you want to understand how it works or change some parts. - The build output is in `site`, you can upload that to wherever static files are served from. +### Starting a `netrepl` from within bagatto + +When running bagatto with the `--repl` flag, you can start a `netrepl` which [Conjure](https://github.com/Olical/conjure) can connect to: + +``` lisp +(def env (curenv)) +(def t (thread/new (fn [_] (netrepl/server "127.0.0.1" 9365 env)))) +``` + +All the bagatto functions like `eval-data` and `eval-site` are available in the netrepl session as well. A static site generator from your repl! 🔥 + ### Continuously rebuild the site on changes Easy as π! Use `entr`, which is included in the development environment: ``` fish -while true; fd | entr -d sh -c 'bag index.janet'; end +while sleep 0.5s; fd | entr -d sh -c 'bag index.janet'; end ``` diff --git a/posts/2021-07-07--let-there-be-light.md b/content/posts/2021-07-07--let-there-be-light.md similarity index 100% rename from posts/2021-07-07--let-there-be-light.md rename to content/posts/2021-07-07--let-there-be-light.md diff --git a/index.janet b/index.janet index edc6711..468d13b 100644 --- a/index.janet +++ b/index.janet @@ -2,17 +2,11 @@ (import spork/netrepl) (import ./views) +(import ./utils) -# --- -# expose the a netrepl for conjure to connect to when running in repl mode -# --- +# disable pretty-printing -(defn bag-repl? [cli-args] - (= ["bag" "--repl"] (slice cli-args 0 2))) - -(def conjure-repl - (when (bag-repl? (dyn :args)) - (thread/new (fn [_] (netrepl/server))))) +(setdyn :pretty-format "%.20q") # --- # site config diff --git a/posts/transclude_text.txt b/posts/transclude_text.txt deleted file mode 100644 index fcdb8dc..0000000 --- a/posts/transclude_text.txt +++ /dev/null @@ -1 +0,0 @@ -Oh wowzers, this is coming from within another file!