diff --git a/README.md b/README.md index ecdd50d..eb29281 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,21 @@ This will create a markdown file in the `data/posts/` directory. The file's fron contains a `draft` key which defaults to true. For the post to appar on the website, that must be changed to false. +## Developing +Included is a bash script `dev.sh` in the `scripts/` directory. Make it executable: +```shell +chmod +x scripts/dev.sh +``` + +Then run it: +```shell +scripts/dev.sh +``` + +This will start Axum server and Tailwind binary in watch modes so that saves +will trigger rebuilds while you're developing. On exiting this process, the Tailwind +binary will minify its outputted css. + ## Building the Tailwind CSS - [Install and config](https://tailwindcss.com/blog/standalone-cli) the Tailwindcss cli. - Run: diff --git a/scripts/dev.sh b/scripts/dev.sh new file mode 100755 index 0000000..5b34d76 --- /dev/null +++ b/scripts/dev.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Bash script to run the axum server and tailwind binary in watch mode so updates +# will automatically be reflected. On exit, will minify tailwind's css. + +minify() { + echo "Minifying css" + sh -c './tailwindcss -i tailwind.css -o ./assets/output.css --minify' +} + +# Start cargo watch in the background +sh -c 'cargo watch -x run &' + +# Add a trap to run the minify function before exiting +trap "minify; kill 0" EXIT + +# Start tailwindcss in watch mode +./tailwindcss -i tailwind.css -o ./assets/output.css --watch