Just Do It

You know: those days it is hard to keep order among the many files (and related generated and derivated files) a modern website is composed by. Aside to write things, you also have to "build" them. In the best scenario you still have to compress Javascript, compile your Sass into CSS, optimize images, and be sure that all those stuffs are executed everytime you change something.

I always had a complex relationship with the many (too many) task runners around. Things like "Grunt" and "Gulp" let me say just "Sigh". Too complex, even more than the tasks they try to accomplish. And for many reasons I always had issues with tools built into the IDE, whichever IDE I decide to use. Perhaps I forgot to npm wft something and some missing package quietly breaks everything.

Looking for a solution, I today began to experiment with the easier one I could find: use incron to script and execute what I usually run by hand.

Incron is self-defined as an "inotify cron": as cron runs commands at given intervals, incron runs commands at given events from the filesystem. Such as, you guess, saving a .js file.

/folder/of/files/js/ IN_CLOSE_WRITE yui-compressor $@/$# -o $@/min/$#

VoilĂ : automatic compression (using yui-compressor in this case) when a Javascript file is modified.

No crazy configuration files to define copying and pasting incomprensible stuff from StackOverflow, no packages nor libraries to download and install to be able to download and install more packages and libraries, not even commands to manually run when required.

Choose the tools you feel more comfortable with, get a rapid look to the man page to choose how to invoke it, read the 15 fucking lines paragraph "How to Use incron", and just do it.