@@ -324,6 +324,8 @@ namespace Sass {
324
324
// (2) underscore + given
325
325
// (3) underscore + given + extension
326
326
// (4) given + extension
327
+ // (5) given + _index.scss
328
+ // (6) given + _index.sass
327
329
std::vector<Include> resolve_includes (const std::string& root, const std::string& file, const std::vector<std::string>& exts)
328
330
{
329
331
std::string filename = join_paths (root, file);
@@ -351,6 +353,25 @@ namespace Sass {
351
353
abs_path = join_paths (root, rel_path);
352
354
if (file_exists (abs_path)) includes.push_back ({{ rel_path, root }, abs_path });
353
355
}
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
+ }
354
375
// nothing found
355
376
return includes;
356
377
}
0 commit comments