Live Preview

During the minimize memory project I was regularly checking the generated documentation to check how it appeared with the code.

Doing that multiple times I quickly started to think how I could have the documents open and have them refreshed when any changed appeared.

Implementation

This was mostly an integration job. I also used literate programming since I thought it would be a smaller and more contained example.

To check when the files are changed and trigger an action I used the inotifywait from inotify-tools.

Since the documentation was built with html I started searching for a browser that allowed me to refresh the page when a modification in a file were detected.

After searching for a bit I found that the suckless project, surf browser allows the refresh of the current page when he receives a SIGHUP signal.

With these I made a simple bash script that receives the file to open the browser with and the files to monitor. When any of the files suffers changes it will trigger a SIGHUP signal to surf telling him to refresh the page.

Result

It was fast to do and gave me a really nice tool to preview in real time my changes. Check the workflow.

Live Preview

And here the full demo.

Literate Programming

Since it was done with literate programming the documents/program can be seen in here

Repository

If you want to see the code or to try the tool check the repository.

Other

If you want to receive updates when there are new games or development stories join the mailing list