sassc-embedded 1.59.0 → 1.64.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/lib/sassc/embedded/version.rb +1 -1
- data/lib/sassc/embedded.rb +55 -48
- metadata +16 -100
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a17b1cef768356ef3f6e43a55502adbba7ebd45da75563fc5490289262eced91
|
4
|
+
data.tar.gz: d09b3fcfa43e8f7a7a78bc188d19a5a970e9b7b468e533b0f58d49909b303182
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfeb102dc0496cead90ca751d94d72cad51c2c132095654cdc0baad049f54909b284d928be53f248dee7d3b74452f0a1181c018b11714b965b8de53736c7f3f5
|
7
|
+
data.tar.gz: a9946e66a973528c32dd77ee778da708a62c3ea6095e9bc0a37cf661698f0add59cb69cb8f9a433380442a5a21a3d6c545a4e066d442ae0453c203d34d3d5654
|
data/README.md
CHANGED
@@ -35,6 +35,12 @@ Or install it yourself as:
|
|
35
35
|
gem install sassc-embedded
|
36
36
|
```
|
37
37
|
|
38
|
+
---
|
39
|
+
|
40
|
+
The fork of `sassc` at https://github.com/sass/sassc-ruby/pull/233 removes the libsass extension and loads the shim when `require 'sassc'` is invoked.
|
41
|
+
|
42
|
+
Alternatively, the original `sassc` gem can be used, but you must explictly call `require 'sassc-embedded'` to load the shim.
|
43
|
+
|
38
44
|
## Usage
|
39
45
|
|
40
46
|
This shim utilizes `sass-embedded` to allow you to compile SCSS or SASS syntax to CSS. To compile, use a `SassC::Engine`, e.g.:
|
data/lib/sassc/embedded.rb
CHANGED
@@ -36,13 +36,26 @@ module SassC
|
|
36
36
|
verbose: @options.fetch(:verbose, false)
|
37
37
|
)
|
38
38
|
|
39
|
-
@
|
40
|
-
|
41
|
-
.map { |url| URL.file_url_to_path(url) }
|
42
|
-
@source_map = post_process_source_map(result.source_map)
|
39
|
+
@loaded_urls = result.loaded_urls
|
40
|
+
@source_map = result.source_map
|
43
41
|
|
44
|
-
return
|
42
|
+
return if quiet?
|
43
|
+
|
44
|
+
css = result.css
|
45
|
+
css += "\n" unless css.empty?
|
46
|
+
unless @source_map.nil? || omit_source_map_url?
|
47
|
+
url = URL.parse(output_url || file_url)
|
48
|
+
source_mapping_url = if source_map_embed?
|
49
|
+
"data:application/json;base64,#{Base64.strict_encode64(@source_map)}"
|
50
|
+
else
|
51
|
+
URL.parse(source_map_file_url).route_from(url).to_s
|
52
|
+
end
|
53
|
+
css += "\n/*# sourceMappingURL=#{source_mapping_url} */"
|
54
|
+
end
|
55
|
+
css
|
45
56
|
rescue ::Sass::CompileError => e
|
57
|
+
@loaded_urls = e.loaded_urls
|
58
|
+
|
46
59
|
line = e.span&.start&.line
|
47
60
|
line += 1 unless line.nil?
|
48
61
|
url = e.span&.url
|
@@ -50,6 +63,31 @@ module SassC
|
|
50
63
|
raise SyntaxError.new(e.full_message, filename: path, line: line)
|
51
64
|
end
|
52
65
|
|
66
|
+
def dependencies
|
67
|
+
raise NotRenderedError unless @loaded_urls
|
68
|
+
|
69
|
+
Dependency.from_filenames(@loaded_urls
|
70
|
+
.filter { |url| url.start_with?(Protocol::FILE) && url != file_url }
|
71
|
+
.map { |url| URL.file_url_to_path(url) })
|
72
|
+
end
|
73
|
+
|
74
|
+
def source_map
|
75
|
+
raise NotRenderedError unless @source_map
|
76
|
+
|
77
|
+
url = URL.parse(source_map_file_url || file_url)
|
78
|
+
data = JSON.parse(@source_map)
|
79
|
+
data['file'] = URL.parse(output_url).route_from(url).to_s if output_url
|
80
|
+
data['sources'].map! do |source|
|
81
|
+
if source.start_with?(Protocol::FILE)
|
82
|
+
URL.parse(source).route_from(url).to_s
|
83
|
+
else
|
84
|
+
source
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
JSON.generate(data)
|
89
|
+
end
|
90
|
+
|
53
91
|
private
|
54
92
|
|
55
93
|
def file_url
|
@@ -57,10 +95,9 @@ module SassC
|
|
57
95
|
end
|
58
96
|
|
59
97
|
def output_path
|
60
|
-
@output_path ||= @options.fetch(
|
61
|
-
|
62
|
-
|
63
|
-
)
|
98
|
+
@output_path ||= @options.fetch(:output_path) do
|
99
|
+
"#{filename.delete_suffix(File.extname(filename))}.css" if filename
|
100
|
+
end
|
64
101
|
end
|
65
102
|
|
66
103
|
def output_url
|
@@ -74,7 +111,7 @@ module SassC
|
|
74
111
|
def output_style
|
75
112
|
@output_style ||= begin
|
76
113
|
style = @options.fetch(:style, :sass_style_nested).to_s
|
77
|
-
style = "sass_style_#{style}" unless style.
|
114
|
+
style = "sass_style_#{style}" unless style.start_with?('sass_style_')
|
78
115
|
raise InvalidStyleError unless OUTPUT_STYLES.include?(style.to_sym)
|
79
116
|
|
80
117
|
style = style.delete_prefix('sass_style_').to_sym
|
@@ -100,37 +137,6 @@ module SassC
|
|
100
137
|
[]
|
101
138
|
end
|
102
139
|
end
|
103
|
-
|
104
|
-
def post_process_source_map(source_map)
|
105
|
-
return unless source_map
|
106
|
-
|
107
|
-
url = URL.parse(source_map_file_url || file_url)
|
108
|
-
data = JSON.parse(source_map)
|
109
|
-
data['file'] = URL.parse(output_url).route_from(url).to_s if output_url
|
110
|
-
data['sources'].map! do |source|
|
111
|
-
if source.start_with?(Protocol::FILE)
|
112
|
-
URL.parse(source).route_from(url).to_s
|
113
|
-
else
|
114
|
-
source
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
JSON.generate(data)
|
119
|
-
end
|
120
|
-
|
121
|
-
def post_process_css(css)
|
122
|
-
css += "\n" unless css.empty?
|
123
|
-
unless @source_map.nil? || omit_source_map_url?
|
124
|
-
url = URL.parse(output_url || file_url)
|
125
|
-
source_mapping_url = if source_map_embed?
|
126
|
-
"data:application/json;base64,#{Base64.strict_encode64(@source_map)}"
|
127
|
-
else
|
128
|
-
URL.parse(source_map_file_url).route_from(url).to_s
|
129
|
-
end
|
130
|
-
css += "\n/*# sourceMappingURL=#{source_mapping_url} */"
|
131
|
-
end
|
132
|
-
css
|
133
|
-
end
|
134
140
|
end
|
135
141
|
|
136
142
|
class FunctionsHandler
|
@@ -181,10 +187,10 @@ module SassC
|
|
181
187
|
rescue StandardError => e
|
182
188
|
unless e.full_message.include?(e.cause.full_message)
|
183
189
|
::Sass::ScriptError.class_eval do
|
184
|
-
def full_message(
|
185
|
-
full_message = super(
|
190
|
+
def full_message(...)
|
191
|
+
full_message = super(...)
|
186
192
|
if cause
|
187
|
-
"#{full_message}\n#{cause.full_message(
|
193
|
+
"#{full_message}\n#{cause.full_message(...)}"
|
188
194
|
else
|
189
195
|
full_message
|
190
196
|
end
|
@@ -311,7 +317,7 @@ module SassC
|
|
311
317
|
end
|
312
318
|
|
313
319
|
canonical_url = "#{Protocol::IMPORT}#{next_id}"
|
314
|
-
@importer_results[canonical_url] = imports_to_native(imports)
|
320
|
+
@importer_results[canonical_url] = imports_to_native(imports, from_import)
|
315
321
|
canonical_url
|
316
322
|
elsif url.start_with?(Protocol::LOADED)
|
317
323
|
canonical_url = Protocol::LOADED
|
@@ -365,7 +371,7 @@ module SassC
|
|
365
371
|
end
|
366
372
|
end
|
367
373
|
|
368
|
-
def imports_to_native(imports)
|
374
|
+
def imports_to_native(imports, from_import)
|
369
375
|
{
|
370
376
|
contents: imports.flat_map do |import|
|
371
377
|
id = next_id
|
@@ -386,9 +392,10 @@ module SassC
|
|
386
392
|
}
|
387
393
|
end
|
388
394
|
end
|
395
|
+
at_rule = from_import ? '@import' : '@forward'
|
389
396
|
[
|
390
|
-
"
|
391
|
-
"
|
397
|
+
"#{at_rule} \"#{Protocol::IMPORT}#{id}\";",
|
398
|
+
"#{at_rule} \"#{Protocol::LOADED}#{id}\";"
|
392
399
|
]
|
393
400
|
end.join("\n"),
|
394
401
|
syntax: :scss
|
metadata
CHANGED
@@ -1,141 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sassc-embedded
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.64.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- なつき
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: base64
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: sassc
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: minitest
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 5.18.0
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 5.18.0
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: minitest-around
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 0.5.0
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 0.5.0
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rake
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 10.0.0
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 10.0.0
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rubocop
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 1.48.0
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 1.48.0
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rubocop-minitest
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: 0.29.0
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: 0.29.0
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rubocop-performance
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: 1.16.0
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: 1.16.0
|
40
|
+
version: '2.0'
|
125
41
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
42
|
+
name: sass-embedded
|
127
43
|
requirement: !ruby/object:Gem::Requirement
|
128
44
|
requirements:
|
129
45
|
- - "~>"
|
130
46
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
132
|
-
type: :
|
47
|
+
version: '1.64'
|
48
|
+
type: :runtime
|
133
49
|
prerelease: false
|
134
50
|
version_requirements: !ruby/object:Gem::Requirement
|
135
51
|
requirements:
|
136
52
|
- - "~>"
|
137
53
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
54
|
+
version: '1.64'
|
139
55
|
description: An embedded sass shim for SassC.
|
140
56
|
email:
|
141
57
|
- i@ntk.me
|
@@ -152,8 +68,8 @@ homepage: https://github.com/ntkme/sassc-embedded-shim-ruby
|
|
152
68
|
licenses:
|
153
69
|
- MIT
|
154
70
|
metadata:
|
155
|
-
documentation_uri: https://rubydoc.info/gems/sassc-embedded/1.
|
156
|
-
source_code_uri: https://github.com/ntkme/sassc-embedded-shim-ruby/tree/v1.
|
71
|
+
documentation_uri: https://rubydoc.info/gems/sassc-embedded/1.64.0
|
72
|
+
source_code_uri: https://github.com/ntkme/sassc-embedded-shim-ruby/tree/v1.64.0
|
157
73
|
funding_uri: https://github.com/sponsors/ntkme
|
158
74
|
post_install_message:
|
159
75
|
rdoc_options: []
|
@@ -163,14 +79,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
163
79
|
requirements:
|
164
80
|
- - ">="
|
165
81
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
82
|
+
version: 3.0.0
|
167
83
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
84
|
requirements:
|
169
85
|
- - ">="
|
170
86
|
- !ruby/object:Gem::Version
|
171
87
|
version: '0'
|
172
88
|
requirements: []
|
173
|
-
rubygems_version: 3.4.
|
89
|
+
rubygems_version: 3.4.10
|
174
90
|
signing_key:
|
175
91
|
specification_version: 4
|
176
92
|
summary: Use dart-sass with SassC!
|