From 33718b028378f9477716e1c4766d6e4196e87661 Mon Sep 17 00:00:00 2001 From: xzyfer Date: Mon, 2 Jul 2018 21:10:56 +1000 Subject: [PATCH] Revert "Remove raw css imports" This reverts commit 27d502612c2ec5f68e0c5f5b9e7f851e3fa1acc9. --- src/file.cpp | 18 +++++++++++++++--- src/file.hpp | 5 +++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/file.cpp b/src/file.cpp index ab2065194..61b8f2ddf 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -323,7 +323,7 @@ namespace Sass { // (2) underscore + given // (3) underscore + given + extension // (4) given + extension - std::vector resolve_includes(const std::string& root, const std::string& file, const std::vector& exts) + std::vector resolve_includes(const std::string& root, const std::string& file, const std::vector& exts, const std::vector& d_exts) { std::string filename = join_paths(root, file); // split the filename @@ -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; diff --git a/src/file.hpp b/src/file.hpp index a043bea7a..718a529cd 100644 --- a/src/file.hpp +++ b/src/file.hpp @@ -127,10 +127,11 @@ namespace Sass { namespace File { static std::vector defaultExtensions = { ".scss", ".sass" }; + static std::vector deprecatedExtensions = { ".css" }; std::vector resolve_includes(const std::string& root, const std::string& file, - const std::vector& exts = defaultExtensions); - + const std::vector& exts = defaultExtensions, + const std::vector& d_exts = deprecatedExtensions); }