Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

To emulate the live preview, there is a neat piece of software called entr[1], from their main page, you can do something like:

    ls | entr make
And whenever you save a change, the build is triggered and the preview is updated.

[1]: http://eradman.com/entrproject/



The pipeline approach here is interesting, but it seems you'd be on your own for filtering out changes in the build directory, etc. I typically use watchexec [1] for this.

    watchexec make
By default, watchexec will filter out changes in files based on `.gitignore`.

[1]: https://github.com/watchexec/watchexec


This is pretty good, didn't know about watchexec, but you can achieve the same by choosing carefully the command you pipe from, for example:

    ls *.md | make
Will only trigger the build if a md file is modified, which is what I think the author is interested in.


I personally use fswatch for this. The invocation is probably something like this:

    fswatch -0 ***.md | xargs -0 make
I invoke a variant of this from my Makefile with a phony watch target. I think the main change is that I also echo a bell character, to provide some feedback.

Fun tip: Preview will automatically reload PDFs on disk, though with some limitations that I workaround by waiting for the bell.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: