6
6
from scss .extension .core import CoreExtension
7
7
from scss .source import SourceFile
8
8
9
- from ..utils import get_file_and_storage
9
+ from ..utils import get_file_and_storage , get_searched_paths
10
10
11
11
12
12
class DjangoExtension (CoreExtension ):
@@ -26,21 +26,23 @@ def handle_import(self, name, compilation, rule):
26
26
27
27
if original_path .is_absolute ():
28
28
# Remove the beginning slash
29
- search_path = original_path .relative_to ('/' ).parent
29
+ origin = original_path .relative_to ('/' ).parent
30
30
elif rule .source_file .origin :
31
- search_path = rule .source_file .origin
31
+ origin = rule .source_file .origin
32
32
if original_path .parent :
33
- search_path = search_path / original_path .parent
33
+ origin = origin / original_path .parent
34
34
else :
35
- search_path = original_path .parent
35
+ origin = original_path .parent
36
36
37
37
basename = original_path .stem
38
38
39
39
for prefix , suffix in product (('_' , '' ), search_exts ):
40
40
filename = PurePath (prefix + basename + suffix )
41
41
42
- full_filename , storage = get_file_and_storage (str (search_path / filename ))
42
+ full_filename , storage = get_file_and_storage (str (origin / filename ))
43
43
44
44
if full_filename :
45
45
with storage .open (full_filename ) as f :
46
- return SourceFile .from_file (f , origin = search_path , relpath = filename )
46
+ return SourceFile .from_file (f , origin = origin , relpath = filename )
47
+
48
+ compilation .compiler .search_path = get_searched_paths (basename )
0 commit comments