Skip to content

Commit 4930f61

Browse files
committed
1 parent a47b0e9 commit 4930f61

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

lib/sass/embedded/host.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
require_relative 'host/function_registry'
44
require_relative 'host/importer_registry'
55
require_relative 'host/logger_registry'
6+
require_relative 'host/no_op_importer'
67
require_relative 'host/value_protofier'
78

89
module Sass
@@ -54,7 +55,13 @@ def compile_request(path:,
5455
source: source,
5556
url: url&.to_s,
5657
syntax: Protofier.to_proto_syntax(syntax),
57-
importer: importer.nil? ? nil : @importer_registry.register(importer)
58+
importer: if url && importer.nil?
59+
EmbeddedProtocol::InboundMessage::CompileRequest::Importer.new(
60+
path: File.absolute_path('.')
61+
)
62+
else
63+
@importer_registry.register(importer.nil? ? NoOpImporter : importer)
64+
end
5865
)
5966
end,
6067
path: path.nil? ? nil : File.absolute_path(path),
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# frozen_string_literal: true
2+
3+
module Sass
4+
class Embedded
5+
class Host
6+
# An importer that never imports any stylesheets.
7+
module NoOpImporter
8+
module_function
9+
10+
def canonicalize(*); end
11+
def load(*); end
12+
end
13+
14+
private_constant :NoOpImporter
15+
end
16+
end
17+
end

0 commit comments

Comments
 (0)