Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Guardfile

Doug edited this page Aug 5, 2013 · 7 revisions

Example Guardfile

Install livereload

https://github.com/lepture/python-livereload

https://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei?hl=en

#!/usr/bin/env python

# Guardfile
# More info at https://github.com/lepture/python-livereload

from livereload.task import Task
from livereload.compiler import shell


def recursive_watch(directory, re_filetype, *args, **kwargs):
  import re
  import os
  pattern = re.compile(re_filetype)
  for root, dirs, files in os.walk(directory):
    for basename in files:
      if pattern.match(basename):
        filename = os.path.join(root, basename)
        Task.add(filename, *args, **kwargs)


recursive_watch("app", r".*")
recursive_watch("app", r".*\.scss$", shell('sass --compass --update', 'app'))
recursive_watch("tailbone/tailbone", r".*\.(py|yaml|html|js|json)")
Clone this wiki locally