@@ -324,6 +324,8 @@ namespace Sass {
324324 // (2) underscore + given
325325 // (3) underscore + given + extension
326326 // (4) given + extension
327+ // (5) given + _index.scss
328+ // (6) given + _index.sass
327329 std::vector<Include> resolve_includes (const std::string& root, const std::string& file, const std::vector<std::string>& exts)
328330 {
329331 std::string filename = join_paths (root, file);
@@ -351,6 +353,25 @@ namespace Sass {
351353 abs_path = join_paths (root, rel_path);
352354 if (file_exists (abs_path)) includes.push_back ({{ rel_path, root }, abs_path });
353355 }
356+ // index files
357+ if (includes.size () == 0 ) {
358+ // ignore directories that look like @import'able filename
359+ for (auto ext : exts) {
360+ if (ends_with (name, ext)) return includes;
361+ }
362+ // next test underscore index exts
363+ for (auto ext : exts) {
364+ rel_path = join_paths (base, join_paths (name, " _index" + ext));
365+ abs_path = join_paths (root, rel_path);
366+ if (file_exists (abs_path)) includes.push_back ({{ rel_path, root }, abs_path });
367+ }
368+ // next test plain index exts
369+ for (auto ext : exts) {
370+ rel_path = join_paths (base, join_paths (name, " index" + ext));
371+ abs_path = join_paths (root, rel_path);
372+ if (file_exists (abs_path)) includes.push_back ({{ rel_path, root }, abs_path });
373+ }
374+ }
354375 // nothing found
355376 return includes;
356377 }
0 commit comments