88from scss .extension .core import CoreExtension
99from scss .source import SourceFile
1010
11- from ..utils import get_file_and_storage
11+ from ..utils import get_file_and_storage , get_searched_paths
1212
1313
1414class DjangoExtension (CoreExtension ):
@@ -29,19 +29,21 @@ def handle_import(self, name, compilation, rule):
2929
3030 if original_path .is_absolute ():
3131 # Remove the beginning slash
32- search_path = original_path .relative_to ('/' ).parent
32+ origin = original_path .relative_to ('/' ).parent
3333 elif rule .source_file .origin :
34- search_path = rule .source_file .origin
34+ origin = rule .source_file .origin
3535 if original_path .parent :
36- search_path = os .path .normpath (str (search_path / original_path .parent ))
36+ origin = os .path .normpath (str (origin / original_path .parent ))
3737 else :
38- search_path = original_path .parent
38+ origin = original_path .parent
3939
4040 for prefix , suffix in product (('_' , '' ), search_exts ):
4141 filename = PurePath (prefix + basename + suffix )
4242
43- full_filename , storage = get_file_and_storage (str (search_path / filename ))
43+ full_filename , storage = get_file_and_storage (str (origin / filename ))
4444
4545 if full_filename :
4646 with storage .open (full_filename ) as f :
47- return SourceFile .from_file (f , origin = search_path , relpath = filename )
47+ return SourceFile .from_file (f , origin = origin , relpath = filename )
48+
49+ compilation .compiler .search_path = get_searched_paths (basename )
0 commit comments