summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Catton <acatton@fusionbox.com>2014-08-04 15:47:24 +0200
committerAntoine Catton <acatton@fusionbox.com>2014-08-04 15:48:05 +0200
commit27ad25016dc17f99112e22f44aa961c12cf25c03 (patch)
tree65f04abf8ac16e9514c0810cac58052d4009a70b
parentd7f1b849a04437a04443d68957717179b6b4d7d3 (diff)
parentc517f87a2c536f6ebd3773b869430572ba3eb811 (diff)
downloaddjango-pyscss-27ad25016dc17f99112e22f44aa961c12cf25c03.tar.gz
Merge branch 'reorder-possible-paths' of https://github.com/deshipu/django-pyscss
* 'reorder-possible-paths' of https://github.com/deshipu/django-pyscss: Put the original path at the end in get_possible_paths Add test for path conflicts Closes #13
-rw-r--r--django_pyscss/scss.py2
-rw-r--r--testproject/testproject/static/css/path_conflict.scss3
-rw-r--r--testproject/testproject/static/css/path_conflict/content.scss3
-rw-r--r--tests/test_scss.py7
4 files changed, 14 insertions, 1 deletions
diff --git a/django_pyscss/scss.py b/django_pyscss/scss.py
index 7429eba..b4c5981 100644
--- a/django_pyscss/scss.py
+++ b/django_pyscss/scss.py
@@ -67,7 +67,6 @@ class DjangoScss(Scss):
path = path[1:]
elif relative_to: # relative import
path = os.path.join(relative_to, path)
- paths.append(path)
dirname, filename = os.path.split(path)
name, ext = os.path.splitext(filename)
@@ -77,6 +76,7 @@ class DjangoScss(Scss):
search_exts = self.supported_extensions
for prefix, suffix in product(('_', ''), search_exts):
paths.append(os.path.join(dirname, prefix + name + suffix))
+ paths.append(path)
return paths
def _find_source_file(self, filename, relative_to=None):
diff --git a/testproject/testproject/static/css/path_conflict.scss b/testproject/testproject/static/css/path_conflict.scss
new file mode 100644
index 0000000..f672943
--- /dev/null
+++ b/testproject/testproject/static/css/path_conflict.scss
@@ -0,0 +1,3 @@
+.path_conflict {
+ color: #000000;
+}
diff --git a/testproject/testproject/static/css/path_conflict/content.scss b/testproject/testproject/static/css/path_conflict/content.scss
new file mode 100644
index 0000000..77c9d58
--- /dev/null
+++ b/testproject/testproject/static/css/path_conflict/content.scss
@@ -0,0 +1,3 @@
+.content {
+ color: #000000;
+}
diff --git a/tests/test_scss.py b/tests/test_scss.py
index bc9c6ef..e2e8748 100644
--- a/tests/test_scss.py
+++ b/tests/test_scss.py
@@ -29,6 +29,9 @@ with open(os.path.join(settings.BASE_DIR, 'testproject', 'static', 'css', 'css_f
with open(os.path.join(settings.BASE_DIR, 'testproject', 'static', 'css', '_baz.scss')) as f:
BAZ_CONTENTS = f.read()
+with open(os.path.join(settings.BASE_DIR, 'testproject', 'static', 'css', 'path_conflict.scss')) as f:
+ PATH_CONFLICT_CONTENTS = f.read()
+
class CompilerTestMixin(object):
def setUp(self):
@@ -84,6 +87,10 @@ class ImportTestMixin(CompilerTestMixin):
actual = self.compiler.compile(scss_string='@import "/css/baz";')
self.assertEqual(clean_css(actual), clean_css(BAZ_CONTENTS))
+ def test_import_conflict(self):
+ actual = self.compiler.compile(scss_string='@import "/css/path_conflict";')
+ self.assertEqual(clean_css(actual), clean_css(PATH_CONFLICT_CONTENTS))
+
@override_settings(DEBUG=True)
class FindersImportTest(ImportTestMixin, TestCase):