sassc-embedded 1.5.6 → 1.5.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sassc/embedded/version.rb +1 -1
- data/lib/sassc/embedded.rb +35 -39
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bfb6d5d03f82fe0caed0330d377a072a9943695119839dedd7927b9353ae234
|
4
|
+
data.tar.gz: a3ab1f40872818454a6dc4df354c053022efc44fe0f8e9f8138eab21645e212c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e85eb1e5be70cdbca5d2561945c9ff8cc291f8721ebc3d1c53e7e58d7dec47953b131ec70c8d8c2d497f1f9a25c16ee84e3e23e465cf18fa62412fd1b99c4974
|
7
|
+
data.tar.gz: af772e37b302bfc34f3db138f79ed86a2628185a6f95699687e0f4d19ff5588c68a01ac50b66e9ddd63a8fa9e518ceaae8d74ff12637056d24c7c1474129ceeb
|
data/lib/sassc/embedded.rb
CHANGED
@@ -293,55 +293,49 @@ module SassC
|
|
293
293
|
end
|
294
294
|
|
295
295
|
def canonicalize(url, from_import:)
|
296
|
-
return url if url.start_with?(Protocol::LOADED)
|
297
|
-
|
298
296
|
if url.start_with?(Protocol::IMPORT)
|
299
|
-
|
300
|
-
return
|
297
|
+
canonical_url = @canonical_urls.delete(url.delete_prefix(Protocol::IMPORT))
|
298
|
+
return canonical_url if canonical_url.start_with?(Protocol::IMPORT)
|
301
299
|
|
300
|
+
unless @importer_results.key?(canonical_url)
|
301
|
+
canonical_url = resolve_file_url(canonical_url, @parent_urls.last, from_import)
|
302
|
+
end
|
303
|
+
@parent_urls.push(canonical_url)
|
304
|
+
canonical_url
|
305
|
+
elsif url.start_with?(Protocol::FILE)
|
302
306
|
path = URL.parse(url).route_from(@parent_urls.last).to_s
|
303
|
-
|
304
|
-
return URL.path_to_file_url(resolved) unless resolved.nil?
|
307
|
+
parent_path = URL.file_url_to_path(@parent_urls.last)
|
305
308
|
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
parent_path = URL.file_url_to_path(@parent_urls.last)
|
309
|
+
imports = @importer.imports(path, parent_path)
|
310
|
+
imports = [SassC::Importer::Import.new(path)] if imports.nil?
|
311
|
+
imports = [imports] unless imports.is_a?(Array)
|
312
|
+
imports.each do |import|
|
313
|
+
import.path = File.absolute_path(import.path, File.dirname(parent_path))
|
314
|
+
end
|
313
315
|
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
316
|
+
id = next_id
|
317
|
+
canonical_url = "#{Protocol::IMPORT}#{id}"
|
318
|
+
@canonical_urls[id] = canonical_url
|
319
|
+
@importer_results[canonical_url] = imports_to_native(imports)
|
320
|
+
canonical_url
|
321
|
+
elsif url.start_with?(Protocol::LOADED)
|
322
|
+
canonical_url = Protocol::LOADED
|
323
|
+
@parent_urls.pop
|
324
|
+
canonical_url
|
319
325
|
end
|
320
|
-
|
321
|
-
id = next_id
|
322
|
-
canonical_url = "#{Protocol::IMPORT}#{id}"
|
323
|
-
@canonical_urls[id] = canonical_url
|
324
|
-
@importer_results[canonical_url] = imports_to_native(imports)
|
325
|
-
canonical_url
|
326
326
|
end
|
327
327
|
|
328
328
|
def load(canonical_url)
|
329
|
-
if
|
329
|
+
if @importer_results.key?(canonical_url)
|
330
330
|
@importer_results.delete(canonical_url)
|
331
331
|
elsif canonical_url.start_with?(Protocol::FILE)
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
contents: File.read(path),
|
339
|
-
syntax: syntax(path),
|
340
|
-
source_map_url: canonical_url
|
341
|
-
}
|
342
|
-
end
|
332
|
+
path = URL.file_url_to_path(canonical_url)
|
333
|
+
{
|
334
|
+
contents: File.read(path),
|
335
|
+
syntax: syntax(path),
|
336
|
+
source_map_url: canonical_url
|
337
|
+
}
|
343
338
|
elsif canonical_url.start_with?(Protocol::LOADED)
|
344
|
-
@parent_urls.pop
|
345
339
|
{
|
346
340
|
contents: '',
|
347
341
|
syntax: :scss
|
@@ -355,10 +349,12 @@ module SassC
|
|
355
349
|
@load_paths ||= (@importer.options[:load_paths] || []) + SassC.load_paths
|
356
350
|
end
|
357
351
|
|
358
|
-
def
|
352
|
+
def resolve_file_url(url, parent_url, from_import)
|
353
|
+
path = URL.parse(url).route_from(parent_url).to_s
|
354
|
+
parent_path = URL.file_url_to_path(parent_url)
|
359
355
|
[File.dirname(parent_path)].concat(load_paths).each do |load_path|
|
360
356
|
resolved = FileImporter.resolve_path(File.absolute_path(path, load_path), from_import)
|
361
|
-
return resolved unless resolved.nil?
|
357
|
+
return URL.path_to_file_url(resolved) unless resolved.nil?
|
362
358
|
end
|
363
359
|
nil
|
364
360
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sassc-embedded
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- なつき
|
@@ -138,8 +138,8 @@ homepage: https://github.com/ntkme/sassc-embedded-polyfill-ruby
|
|
138
138
|
licenses:
|
139
139
|
- MIT
|
140
140
|
metadata:
|
141
|
-
documentation_uri: https://rubydoc.info/gems/sassc-embedded/1.5.
|
142
|
-
source_code_uri: https://github.com/ntkme/sassc-embedded-polyfill-ruby/tree/v1.5.
|
141
|
+
documentation_uri: https://rubydoc.info/gems/sassc-embedded/1.5.7
|
142
|
+
source_code_uri: https://github.com/ntkme/sassc-embedded-polyfill-ruby/tree/v1.5.7
|
143
143
|
funding_uri: https://github.com/sponsors/ntkme
|
144
144
|
post_install_message:
|
145
145
|
rdoc_options: []
|