Skip to content

Commit

Permalink
add dev script
Browse files Browse the repository at this point in the history
  • Loading branch information
Austionian committed Sep 28, 2023
1 parent 17a7fc6 commit 7d5d78a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
17 changes: 17 additions & 0 deletions scripts/dev.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 7d5d78a

Please sign in to comment.