thanethomson / httpwatcher

Python-based HTTP server for static files with live reload
MIT License
20 stars 10 forks source link

httpwatcher lacks ignore capability/watches dotfiles #7

Open koitsu opened 4 years ago

koitsu commented 4 years ago

This is a feature request.

Problem

Currently, httpwatcher watches for any changes in the directories provided.

However, this poses a problem for people who use Vim which writes temporary files called "swap files" (unrelated to UNIX swap) to the same directory as the actual source file itself (e.g. vim foo.md will create a temporary file called .foo.md.swp). In the case of Vim, these temporary files are updated extremely often (way more than I initially thought), which causes httpwatcher to notice changes -- and in turn, things like Statik to rebuild the site when it isn't necessary. Wasted CPU time, wasted I/O, wasted everything.

While Vim has ways to work around this -- most of which are awful (e.g. using /tmp for this doesn't guarantee safety since many OSes have systemd services or cron jobs that clean out /tmp periodically) -- this matter is not limited to just Vim.

Comparatively: livereload has the ability to look for only certain file extensions of files that have changed.

I'll add that other "live filesystem change-monitoring" programs tend to ignore dotfiles as they're treated as "hidden" (so-to-speak; yes I am well aware that inotify(7) on Linux and kqueue(2) on BSD and other implementations do not differentiate dotfiles from non-dotfiles, but this is one of several reasons why software using those implementations ignore dotfiles). This approach alleviates the issue too.

Request Details

It would be nice if httpwatcher had one or more of these implemented (I personally don't care which one):

Thank you!

jobveldhuis commented 3 years ago

Hey there, this sounds like a good feature to add to me. Do you want to pick it up, or should I pick this up?

koitsu commented 3 years ago

I do not have the cycles to implement this right now. If you could put it on your TODO list for some point in the future, I'd really appreciate it! No rush though. Thank you!

jobveldhuis commented 3 years ago

I have added it to the top of my todo list and will start working on it once I have some time. Will keep you posted!