Skip to content

Commit

Permalink
Make Server().watch() accept
Browse files Browse the repository at this point in the history
  • Loading branch information
mgedmin committed Nov 4, 2015
1 parent 4c4e94b commit dfbd714
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions livereload/server.py
Expand Up @@ -174,7 +174,7 @@ def __init__(self, app=None, watcher=None):
watcher = watcher_cls()
self.watcher = watcher

def watch(self, filepath, func=None, delay=None):
def watch(self, filepath, func=None, delay=None, ignore=None):
"""Add the given filepath for watcher list.
Once you have intialized a server, watch file changes before
Expand All @@ -194,11 +194,13 @@ def alert():
:param delay: Delay sending the reload message. Use 'forever' to
not send it. This is useful to compile sass files to
css, but reload on changed css files then only.
:param ignore: A function return True to ignore a certain pattern of
filepath.
"""
if isinstance(func, string_types):
func = shell(func)

self.watcher.watch(filepath, func, delay)
self.watcher.watch(filepath, func, delay, ignore=ignore)

def application(self, port, host, liveport=None, debug=None):
LiveReloadHandler.watcher = self.watcher
Expand Down

0 comments on commit dfbd714

Please sign in to comment.