What does HackerNews think of entr?

Run arbitrary commands when files change

Language: C

I use something very similar on https://lunar.fyi and https://lowtechguys.com but I wouldn’t call this “simple” anymore.

They use Jinja templating, I prefer Slim (https://github.com/slim-template/slim#syntax-example) which has a more Pythonic syntax (there is plim [0] in Python for that)

I use Tailwind as well for terse styling and fast experimentation (allows me to write a darkMode-aware and responsive 100 line CSS in a single line with about 10 classes)

For interaction I can write CoffeeScript directly in the page [1] and have it compiled by plim.

I run a Caddy static server [2] and use Syncthing [3] to have every file save deployed instantly to my Hetzner server.

I use entr [4] and livereloadx [5] to rebuild the pages and do hot reload on file save. All the commands are managed in a simple Makefile [6]

———

You can already see how the footnotes take up a large chunk of this comment, this is not my idea of simple. Sure, the end result is readable static HTML and I never have to fight obscure React errors, but it’s a high effort setup for starters.

Simple for me would be: write markdown files for pages, a simple CSS for general styling (should be optional), click to deploy on my domain. Images should automatically be resized to multiple sizes and optimized, videos re-encoded for smaller filesize etc.

I have mostly implemented that for myself (https://notes.alinpanaitiu.com/How%20I%20write%20this%20blog...) but it feels fragile. I’d rather pay for a professional solution.

[0] https://plim.readthedocs.io/en/latest/

[1] https://github.com/FuzzyIdeas/lowtechguys/blob/main/src/rcmd...

[2] https://caddyserver.com/docs/command-line#caddy-file-server

[3] https://syncthing.net

[4] https://github.com/eradman/entr

[5] https://nitoyon.github.io/livereloadx/

[6] https://github.com/FuzzyIdeas/lowtechguys/blob/main/Makefile

Mentioned in reflex's competition section I am a huge fan of entr

https://github.com/eradman/entr

I do something similar using entr [0][1]. I use it instead of `watch` because I would rather not re-run things if no relevant files have changed.

For example, I run:

  fd -e j2 -e py | entr -c python3 build.py
To rebuild a static site every time the build script[2] (py) or a Jinja2 template (j2) changes.

[0]: https://github.com/eradman/entr

[1]: https://jvns.ca/blog/2020/06/28/entr/

[2]: https://gist.github.com/polyrand/3bed83897658806bd490e1d44df...

The page linked above says:

> WARNING: This is a (possibly outdated and/or unmaintained) fork of https://github.com/eradman/entr .

You could launch the container itself with sleep. (docker run --entrypoint /bin/sh [image] sleep inf) Then start the dev watch thing with 'docker exec', and when you don't need it anymore you can kill it. (Eg. via htop)

With uwsgi you can control which file to watch. I usually just set it to watch the index.py so when I want to restart it, I just switch to that and save the file.

Similarly you could do this with "entr" https://github.com/eradman/entr

In a similar vein, "entr" (https://github.com/eradman/entr) relaunches any CLI command whenever the specified files/directory changes, with the possibility to clear the screen every time.