Skip to content

Commit

Permalink
Remove raw css imports
Browse files Browse the repository at this point in the history
This is a non-standard, and confusion feature. Implementors can now
opt into supporting @import'ing additional file extentions with
`sass_option_push_import_extension`.
  • Loading branch information
xzyfer committed Mar 30, 2018
1 parent 6fe62e9 commit 27d5026
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
18 changes: 3 additions & 15 deletions src/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ namespace Sass {
// (2) underscore + given
// (3) underscore + given + extension
// (4) given + extension
std::vector<Include> resolve_includes(const std::string& root, const std::string& file, const std::vector<std::string>& exts, const std::vector<std::string>& d_exts)
std::vector<Include> resolve_includes(const std::string& root, const std::string& file, const std::vector<std::string>& exts)
{
std::string filename = join_paths(root, file);
// split the filename
Expand All @@ -342,25 +342,13 @@ namespace Sass {
for(auto ext : exts) {
rel_path = join_paths(base, "_" + name + ext);
abs_path = join_paths(root, rel_path);
if (file_exists(abs_path)) includes.push_back({{ rel_path, root }, abs_path });
if (file_exists(abs_path)) includes.push_back({{ rel_path, root }, abs_path, ext == ".css" });
}
// next test plain name with exts
for(auto ext : exts) {
rel_path = join_paths(base, name + ext);
abs_path = join_paths(root, rel_path);
if (file_exists(abs_path)) includes.push_back({{ rel_path, root }, abs_path });
}
// next test d_exts plus underscore
for(auto ext : d_exts) {
rel_path = join_paths(base, "_" + name + ext);
abs_path = join_paths(root, rel_path);
if (file_exists(abs_path)) includes.push_back({{ rel_path, root }, abs_path, true });
}
// next test plain name with d_exts
for(auto ext : d_exts) {
rel_path = join_paths(base, name + ext);
abs_path = join_paths(root, rel_path);
if (file_exists(abs_path)) includes.push_back({{ rel_path, root }, abs_path, true });
if (file_exists(abs_path)) includes.push_back({{ rel_path, root }, abs_path, ext == ".css" });
}
// nothing found
return includes;
Expand Down
5 changes: 2 additions & 3 deletions src/file.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,10 @@ namespace Sass {
namespace File {

static std::vector<std::string> defaultExtensions = { ".scss", ".sass" };
static std::vector<std::string> deprecatedExtensions = { ".css" };

std::vector<Include> resolve_includes(const std::string& root, const std::string& file,
const std::vector<std::string>& exts = defaultExtensions,
const std::vector<std::string>& d_exts = deprecatedExtensions);
const std::vector<std::string>& exts = defaultExtensions);


}

Expand Down

0 comments on commit 27d5026

Please sign in to comment.