Skip to content

Commit

Permalink
Translate @use glob as nested @forward
Browse files Browse the repository at this point in the history
  • Loading branch information
ntkme committed Aug 18, 2023
1 parent 52373e2 commit 7977c59
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/sassc/embedded.rb
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def canonicalize(url, from_import:)
end

canonical_url = "#{Protocol::IMPORT}#{next_id}"
@importer_results[canonical_url] = imports_to_native(imports)
@importer_results[canonical_url] = imports_to_native(imports, from_import)
canonical_url
elsif url.start_with?(Protocol::LOADED)
canonical_url = Protocol::LOADED
Expand Down Expand Up @@ -371,7 +371,7 @@ def syntax(path)
end
end

def imports_to_native(imports)
def imports_to_native(imports, from_import)
{
contents: imports.flat_map do |import|
id = next_id
Expand All @@ -392,9 +392,10 @@ def imports_to_native(imports)
}
end
end
at_rule = from_import ? '@import' : '@forward'
[
"@import \"#{Protocol::IMPORT}#{id}\";",
"@import \"#{Protocol::LOADED}#{id}\";"
"#{at_rule} \"#{Protocol::IMPORT}#{id}\";",
"#{at_rule} \"#{Protocol::LOADED}#{id}\";"
]
end.join("\n"),
syntax: :scss
Expand Down

0 comments on commit 7977c59

Please sign in to comment.