Skip to content

Instantly share code, notes, and snippets.

@cballou
Created March 9, 2017 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cballou/ce56bc072b49d977691ebb5b3df81155 to your computer and use it in GitHub Desktop.
Save cballou/ce56bc072b49d977691ebb5b3df81155 to your computer and use it in GitHub Desktop.
Watchdog is a PHP library using inotify to watch for file changes.
<?php
return array(
'types' => array('sass', 'scss', 'less', 'styl', 'jade', 'haml'),
'watch' => array(
'/path/to/public/css',
'/path/to/alternate/css'
),
'minify' => true,
'ignore' => array()
);
<?php
return array(
'types' => array('sass', 'scss', 'less', 'styl', 'jade', 'haml'),
'watch' => array(
// key => val equivalent to input file for compilation => output file (result of compiling)
'/path/to/public/css/dynamic/' => '/path/to/public/css/',
// assume the input path and output path are the same
'/path/to/alternate/css',
// watch a specific file
'/path/to/public/html/view.jade'
),
'minify' => true,
'ignore' => array(
'mixins.less'
)
);
# watch stylus files contained within /path/to/public/css/
./watchdog --types styl --watch /path/to/public/css/
# watch all supported file types contained within /path/to/public/css/
./watchdog --types styl,sass,scss,less,jade,haml --watch /path/to/public/css/
# watch Stylus and LESS but ignore files matching mixins.less
./watchdog --types styl,less --watch /path/to/public/css/ --ignore mixins.less
# watch LESS files but ignore files matching mixins.less
./watchdog --types less --watch /path/to/public/css/less/ --ignore mixins.less --
# begin watching using a PHP configuration file
./watchdog --config /path/to/config.php
# display help
./watchdog --help
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment