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
This commit is contained in:
commit
27ad25016d
|
@ -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):
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
.path_conflict {
|
||||
color: #000000;
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
.content {
|
||||
color: #000000;
|
||||
}
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue