Skip to content

Commit

Permalink
Deletes html files in public corresponding to those is src
Browse files Browse the repository at this point in the history
  • Loading branch information
JanssenSimon committed Oct 23, 2022
1 parent c3be785 commit 268d883
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,3 @@ files into html pages.
3. Point a webserver to `public/`
4. ???
5. Profit.


## What's in the works?
- Have the wimp delete html files when their corresponding
markdown file is deleted from `src/`.
9 changes: 6 additions & 3 deletions wimp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,13 @@ mkdir "${outpath%/*}"; fi; pandoc --quiet -s "$0" -H includes/head.html \
}
# launches inotifywait to watch for writes to src files in order to compile them to html
wimp_watch() {
inotifywait -qmre modify --format "%w%f" ./src/ |\
while read filepath;
inotifywait -qmre modify -e delete --format "%e %w%f" ./src/ |\
while read inotifymessage;
do
wimp_compile $filepath
filepath=${inotifymessage##* }
outpath="${filepath%.md}.html"; outpath="./public/${outpath##*src/}"
if [ "${inotifymessage%% *}" = DELETE ]; then rm -rf $outpath
else wimp_compile $filepath; fi
done &
}
# initializes the current directory for wimp, calls create_directories and create_daemon
Expand Down

0 comments on commit 268d883

Please sign in to comment.