Watchdog is a PHP class implementing inotify which watches for changes to dynamic css files (LESS, SASS, and Stylus) and regenerates their output files on the fly. Specifically, watchdog watches for changes to files in any given number of directories specified in the input. It will not recursively check directories, so you must implicitly specify each directory you want watched. Although it was developed for the purpose of monitoring dynamic css files for changes and auto-regenerating their output, it can easily be transformed into a watchdog for just about anything related to file modifications. For instance, you could automatically log when files are modified or send an email alert.
Watchdog currently supports compilation of Stylus, SASS, LESS, Jade, and HAML. If you have anything else you'd like added to the list, send a pull request!
Watchdog requires you to have the PHP PEAR library inotify installed. If you have PEAR installed, you may run the following from the command line to install inotify:
sudo pecl install inotify
Example command line usage of watchdog for a variety of types:
You can also create a PHP configuration file for Watchdog. The configuration file is slightly more customizable than specifying arguments via the command line. For starters, you can specify both the input file/directory and output file/directory of watched files/directories which comes in handy if you store your files in two separate directories.
Here's a more advanced configuration file demonstrating all available options:
Watchdog is currently hosted on Github.
git clone https://github.com/cballou/Watchdog.git
git clone email@example.com:cballou/Watchdog.git
If you have any problems with Watchdog, please file a ticket/issue/bug on Github and I will attempt to address it at my earliest convenience.Watchdog Issues on Github
Watchdog is licensed under the Apache 2.0 License