Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
Revert "Remove raw css imports"
Browse files Browse the repository at this point in the history
This reverts commit 27d5026.
  • Loading branch information
xzyfer committed Jul 2, 2018
1 parent d18fd47 commit 33718b0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
18 changes: 15 additions & 3 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)
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::string filename = join_paths(root, file);
// split the filename
Expand All @@ -342,13 +342,25 @@ 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, ext == ".css" });
if (file_exists(abs_path)) includes.push_back({{ rel_path, root }, abs_path });
}
// 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, ext == ".css" });
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 });
}
// nothing found
return includes;
Expand Down
5 changes: 3 additions & 2 deletions src/file.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,11 @@ 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>& exts = defaultExtensions,
const std::vector<std::string>& d_exts = deprecatedExtensions);

}

Expand Down

0 comments on commit 33718b0

Please sign in to comment.