sassc-embedded 1.68.1 → 1.68.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c1bae171b142e9c93398da7fd657e968c0804ce760bd7c05e04dc59a1d6c408
4
- data.tar.gz: e45f9276e88a116aa2f83f592187b3705a6b2989b7837e90ca6917fbc418a51e
3
+ metadata.gz: ebda8193661d3e610338c37843843a7437ba861a3bc75e44a83b0f2fc6490248
4
+ data.tar.gz: fd67e61a4b5ddceb37c96f6c7793c9d2d6322612267f183fe09bd7fe71d278ab
5
5
  SHA512:
6
- metadata.gz: 5f36c1fd78fbebbb9af4bf20126b0024aa0ca15a1900ed258390c449d1de36294c96160c0e9c76777d1a2ff053564b650b0b048038ceb03f7a2c64f3c9f8d88f
7
- data.tar.gz: fc2bf82ab1c39773ea130bea388028c649dab02e71e35c9f31a2cbbb4f9a30be4718a535b628f5dbeef5fac1b43009e6c3776765c3d10b2399d0aba8019bd9ab
6
+ metadata.gz: 84d93ee23538b49add2e6ef11446cda4db188f974d742eb4982fb476daef8625471f679032c59195a4c894facc5394b4c04bcd16b7de82ea788516c71929ad9b
7
+ data.tar.gz: 8b776a2fd9357e6b4b0e9b515903c0fbde759574058ef8cb88c7a98e146520fbf5e784b2561bd9d90c382c3ff7dc07d3bb852e5931f100b02648610aea5e84a2
data/README.md CHANGED
@@ -9,52 +9,13 @@ This library shims [`sassc`](https://github.com/sass/sassc-ruby) with the [`sass
9
9
 
10
10
  It has been tested with:
11
11
 
12
+ - [`bootstrap`](https://github.com/twbs/bootstrap-rubygem)
12
13
  - [`sassc`](https://github.com/sass/sassc-ruby)
13
14
  - [`sassc-rails`](https://github.com/sass/sassc-rails)
14
15
  - [`sprockets`](https://github.com/rails/sprockets)
15
16
  - [`sprockets-rails`](https://github.com/rails/sprockets-rails)
16
17
 
17
- ## Uninstall `sassc`
18
-
19
- Execute:
20
-
21
- ``` sh
22
- bundle remove sassc
23
- ```
24
-
25
- Or uninstall it yourself as:
26
-
27
- ``` sh
28
- gem uninstall sassc
29
- ```
30
-
31
- **If your application has a transitive dependency on `sassc` that cannot be removed, you can use any of the following workarounds.**
32
-
33
- ### Workaround One
34
-
35
- Add this line to your application's Gemfile:
36
-
37
- ``` ruby
38
- gem 'sassc', github: 'sass/sassc-ruby', ref: 'refs/pull/233/head'
39
- ```
40
-
41
- And then execute:
42
-
43
- ``` sh
44
- bundle
45
- ```
46
-
47
- The fork of `sassc` at https://github.com/sass/sassc-ruby/pull/233 will load the shim automatically when `require 'sassc'` is invoked, meaning no other code changes needed in your application.
48
-
49
- ### Workaround Two
50
-
51
- Add this line to your application's code:
52
-
53
- ``` ruby
54
- require 'sassc-embedded'
55
- ```
56
-
57
- ## Install `sassc-embedded`
18
+ ## Install
58
19
 
59
20
  Add this line to your application's Gemfile:
60
21
 
@@ -95,3 +56,45 @@ See [rubydoc.info/gems/sassc](https://rubydoc.info/gems/sassc) for full API docu
95
56
  3. Option `:line_comments` is ignored.
96
57
 
97
58
  See [the dart-sass documentation](https://github.com/sass/dart-sass#behavioral-differences-from-ruby-sass) for other differences.
59
+
60
+ ## Troubleshooting
61
+
62
+ ### The original `sassc` gem is still being used instead of `sassc-embedded`
63
+
64
+ When launching an application via `bundle exec`, it puts `sassc-embedded` at higher priority than `sassc` in `$LOAD_PATH`. You can verify the order of `$LOAD_PATH` with the following command:
65
+
66
+ ``` ruby
67
+ bundle exec ruby -e 'puts $LOAD_PATH'
68
+ ```
69
+
70
+ If you see `sassc` has higher priority than `sassc-embedded`, try remove `sassc`:
71
+
72
+ ```
73
+ bundle remove sassc
74
+ ```
75
+
76
+ If your application has a transitive dependency on `sassc` that cannot be removed, you can use one of the following workarounds.
77
+
78
+ #### Workaround One
79
+
80
+ Add this line to your application's Gemfile:
81
+
82
+ ``` ruby
83
+ gem 'sassc', github: 'sass/sassc-ruby', ref: 'refs/pull/233/head'
84
+ ```
85
+
86
+ And then execute:
87
+
88
+ ``` sh
89
+ bundle
90
+ ```
91
+
92
+ The fork of `sassc` at https://github.com/sass/sassc-ruby/pull/233 will load the shim whenever `require 'sassc'` is invoked, meaning no other code changes needed in your application.
93
+
94
+ #### Workaround Two
95
+
96
+ Add this line to your application's code:
97
+
98
+ ``` ruby
99
+ require 'sassc-embedded'
100
+ ```
@@ -2,6 +2,6 @@
2
2
 
3
3
  module SassC
4
4
  module Embedded
5
- VERSION = '1.68.1'
5
+ VERSION = '1.68.3'
6
6
  end
7
7
  end
@@ -49,7 +49,7 @@ module SassC
49
49
  source_mapping_url = if source_map_embed?
50
50
  "data:application/json;base64,#{[@source_map].pack('m0')}"
51
51
  else
52
- URL.unescape(URL.parse(source_map_file_url).route_from(url).to_s)
52
+ URL.file_urls_to_relative_url(source_map_file_url, url)
53
53
  end
54
54
  css += "\n/*# sourceMappingURL=#{source_mapping_url} */"
55
55
  end
@@ -61,7 +61,7 @@ module SassC
61
61
  line += 1 unless line.nil?
62
62
  url = e.span&.url
63
63
  path = if url&.start_with?(Protocol::FILE)
64
- URL.unescape(URL.parse(url).route_from(URL.path_to_file_url("#{Dir.pwd}/")).to_s)
64
+ URL.file_urls_to_relative_path(url, URL.path_to_file_url("#{Dir.pwd}/"))
65
65
  end
66
66
  raise SyntaxError.new(e.full_message, filename: path, line: line)
67
67
  end
@@ -69,9 +69,9 @@ module SassC
69
69
  def dependencies
70
70
  raise NotRenderedError unless @loaded_urls
71
71
 
72
- Dependency.from_filenames(@loaded_urls
73
- .filter { |url| url.start_with?(Protocol::FILE) && url != file_url }
74
- .map { |url| URL.file_url_to_path(url) })
72
+ Dependency.from_filenames(@loaded_urls.filter_map do |url|
73
+ URL.file_url_to_path(url) if url.start_with?(Protocol::FILE) && url != file_url
74
+ end)
75
75
  end
76
76
 
77
77
  def source_map
@@ -79,10 +79,10 @@ module SassC
79
79
 
80
80
  url = URL.parse(source_map_file_url || file_url)
81
81
  data = JSON.parse(@source_map)
82
- data['file'] = URL.unescape(URL.parse(output_url).route_from(url).to_s) if output_url
82
+ data['file'] = URL.file_urls_to_relative_url(output_url, url) if output_url
83
83
  data['sources'].map! do |source|
84
84
  if source.start_with?(Protocol::FILE)
85
- URL.unescape(URL.parse(source).route_from(url).to_s)
85
+ URL.file_urls_to_relative_url(source, url)
86
86
  else
87
87
  source
88
88
  end
@@ -309,7 +309,7 @@ module SassC
309
309
  @parent_urls.push(canonical_url)
310
310
  canonical_url
311
311
  elsif url.start_with?(Protocol::FILE)
312
- path = URL.unescape(URL.parse(url).route_from(@parent_urls.last).to_s)
312
+ path = URL.file_urls_to_relative_path(url, @parent_urls.last)
313
313
  parent_path = URL.file_url_to_path(@parent_urls.last)
314
314
 
315
315
  imports = @importer.imports(path, parent_path)
@@ -354,7 +354,7 @@ module SassC
354
354
  end
355
355
 
356
356
  def resolve_file_url(url, parent_url, from_import)
357
- path = URL.unescape(URL.parse(url).route_from(parent_url).to_s)
357
+ path = URL.file_urls_to_relative_path(url, parent_url)
358
358
  parent_path = URL.file_url_to_path(parent_url)
359
359
  [File.dirname(parent_path)].concat(load_paths).each do |load_path|
360
360
  resolved = FileImporter.resolve_path(File.absolute_path(path, load_path), from_import)
@@ -568,6 +568,14 @@ module SassC
568
568
  PARSER.unescape(str)
569
569
  end
570
570
 
571
+ def file_urls_to_relative_url(url, from_url)
572
+ parse(url).route_from(from_url).to_s
573
+ end
574
+
575
+ def file_urls_to_relative_path(url, from_url)
576
+ unescape(file_urls_to_relative_url(url, from_url))
577
+ end
578
+
571
579
  def file_url_to_path(url)
572
580
  return if url.nil?
573
581
 
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.68.1
4
+ version: 1.68.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - なつき
@@ -78,7 +78,7 @@ licenses:
78
78
  - MIT
79
79
  metadata:
80
80
  documentation_uri: https://rubydoc.info/gems/sassc
81
- source_code_uri: https://github.com/ntkme/sassc-embedded-shim-ruby/tree/v1.68.1
81
+ source_code_uri: https://github.com/ntkme/sassc-embedded-shim-ruby/tree/v1.68.3
82
82
  funding_uri: https://github.com/sponsors/ntkme
83
83
  post_install_message:
84
84
  rdoc_options: []