66from scss .extension .core import CoreExtension
77from scss .source import SourceFile
88
9- from ..utils import get_file_and_storage
9+ from ..utils import get_file_and_storage , get_searched_paths
1010
1111
1212class DjangoExtension (CoreExtension ):
@@ -26,21 +26,23 @@ def handle_import(self, name, compilation, rule):
2626
2727 if original_path .is_absolute ():
2828 # Remove the beginning slash
29- search_path = original_path .relative_to ('/' ).parent
29+ origin = original_path .relative_to ('/' ).parent
3030 elif rule .source_file .origin :
31- search_path = rule .source_file .origin
31+ origin = rule .source_file .origin
3232 if original_path .parent :
33- search_path = search_path / original_path .parent
33+ origin = origin / original_path .parent
3434 else :
35- search_path = original_path .parent
35+ origin = original_path .parent
3636
3737 basename = original_path .stem
3838
3939 for prefix , suffix in product (('_' , '' ), search_exts ):
4040 filename = PurePath (prefix + basename + suffix )
4141
42- full_filename , storage = get_file_and_storage (str (search_path / filename ))
42+ full_filename , storage = get_file_and_storage (str (origin / filename ))
4343
4444 if full_filename :
4545 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