Search through include paths when looking for imports.

parent 569baeef
...@@ -101,17 +101,16 @@ namespace Sass { ...@@ -101,17 +101,16 @@ namespace Sass {
if (!lex< string_constant >()) throw_syntax_error("@import directive requires a url or quoted path"); if (!lex< string_constant >()) throw_syntax_error("@import directive requires a url or quoted path");
// TO DO: BETTER PATH HANDLING // TO DO: BETTER PATH HANDLING
string import_path(lexed.unquote()); string import_path(lexed.unquote());
const char* curr_path_start = path.c_str(); for (vector<string>::iterator path = context.include_paths.begin(); path < context.include_paths.end(); ++path) {
const char* curr_path_end = folders(curr_path_start); try {
string current_path(curr_path_start, curr_path_end - curr_path_start); Document importee(Document::make_from_file(context, *path + import_path));
try { importee.parse_scss();
Document importee(Document::make_from_file(context, current_path + import_path)); return importee.root;
importee.parse_scss(); }
return importee.root; catch (string& path) {
} }
catch (string& path) {
throw_read_error("error reading file \"" + path + "\"");
} }
throw_read_error("error reading file \"" + import_path + "\"");
// unreached statement // unreached statement
return Node(); return Node();
} }
...@@ -1196,4 +1195,4 @@ namespace Sass { ...@@ -1196,4 +1195,4 @@ namespace Sass {
return result; return result;
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment