From d3dd06aeb3738f6215eab3c657220ead030fcba3 Mon Sep 17 00:00:00 2001
From: Kálmán Viktor <kviktor@cloud.bme.hu>
Date: Tue, 28 Oct 2014 12:20:02 +0100
Subject: [PATCH] circle: ignore bower components and static files in less watch

---
 circle/common/management/commands/watch.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/circle/common/management/commands/watch.py b/circle/common/management/commands/watch.py
index c704fca..e0889a3 100644
--- a/circle/common/management/commands/watch.py
+++ b/circle/common/management/commands/watch.py
@@ -6,6 +6,7 @@ from django.core.management.base import BaseCommand
 from django.conf import settings
 
 STATIC_FILES = u'--include-path={}'.format(':'.join(settings.STATICFILES_DIRS))
+IGNORED_FOLDERS = ("static_collected", "bower_components", )
 
 
 class LessUtils(object):
@@ -39,8 +40,7 @@ class LessUtils(object):
                     continue
 
                 relpath = os.path.relpath(root, settings.SITE_ROOT)
-                if relpath.startswith(("static_collected",
-                                       "bower_components")):
+                if relpath.startswith(IGNORED_FOLDERS):
                     continue
 
                 less_pathname = "%s/%s" % (root, f)
@@ -59,6 +59,10 @@ class LessUtils(object):
                 if not event.name.endswith(".less"):
                     return
 
+                relpath = os.path.relpath(event.pathname, settings.SITE_ROOT)
+                if relpath.startswith(IGNORED_FOLDERS):
+                    return
+
                 css_pathname = LessUtils.less_path_to_css_path(event.pathname)
                 LessUtils.compile_less(event.pathname, css_pathname)
 
--
libgit2 0.26.0