nanoc-dart-sass 1.0.4 → 2.0.0
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 +4 -4
- data/NEWS.md +10 -0
- data/lib/nanoc/dart_sass/filter.rb +72 -55
- data/lib/nanoc/dart_sass/version.rb +1 -1
- metadata +9 -18
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a840ef7c17c7990a2284598a2c33f76f7ab9e8dc36a2b80b5f92fed04d372e76
|
|
4
|
+
data.tar.gz: c3af25569e9f23519cf53bad2cdd5f01bfbb328d3e6f732447f6f5fa68eee76b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 794c4037f669e64e01c4bcae49c3a83b790d13d8598d39f99e5e128127735adea09cb9d384f8973aec4ab58e70af7990d7369f7f048772b97b3d0b46bcb8f310
|
|
7
|
+
data.tar.gz: 94a5d55959ba24ea46254632bfa1ed2c1e3b7424f69084ae628f0be68afe66cab37e0e92e59f0abced939710bd34af8bec880cf2ce09b514bde6f86f483c74d3
|
data/NEWS.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# nanoc-dart-sass news
|
|
2
2
|
|
|
3
|
+
## 2.0.0 (2025-12-31)
|
|
4
|
+
|
|
5
|
+
Features:
|
|
6
|
+
|
|
7
|
+
- Added support for `source_map` option [ntkme] (#1749, #1775)
|
|
8
|
+
|
|
9
|
+
Changes:
|
|
10
|
+
|
|
11
|
+
- Changed the importer to be in line with the spec [ntkme] (#1755)
|
|
12
|
+
|
|
3
13
|
## 1.0.4 (2024-11-04)
|
|
4
14
|
|
|
5
15
|
Fixes:
|
|
@@ -18,30 +18,37 @@ module Nanoc
|
|
|
18
18
|
|
|
19
19
|
result = Sass.compile_string(
|
|
20
20
|
content,
|
|
21
|
-
|
|
21
|
+
source_map_include_sources: true,
|
|
22
22
|
**params,
|
|
23
|
+
importers: [NanocImporter.new(@items)].concat(params.fetch(:importers, [])),
|
|
23
24
|
syntax:,
|
|
25
|
+
url: Addressable::URI.new({ scheme: 'nanoc', path: item.identifier.to_s }).to_s,
|
|
24
26
|
)
|
|
25
|
-
|
|
27
|
+
|
|
28
|
+
if result.source_map
|
|
29
|
+
"#{result.css}\n/*# sourceMappingURL=data:application/json;base64,#{[result.source_map].pack('m0')} */"
|
|
30
|
+
else
|
|
31
|
+
result.css
|
|
32
|
+
end
|
|
26
33
|
end
|
|
27
34
|
|
|
28
35
|
class NanocImporter
|
|
29
|
-
def initialize(items
|
|
36
|
+
def initialize(items)
|
|
30
37
|
@items = items
|
|
31
|
-
@source_item = source_item
|
|
32
38
|
end
|
|
33
39
|
|
|
34
|
-
def canonicalize(url,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
def canonicalize(url, context)
|
|
41
|
+
uri = Addressable::URI.parse(url)
|
|
42
|
+
uri = Addressable::URI.parse(context.containing_url).join(uri) unless context.containing_url.nil?
|
|
43
|
+
return unless uri.scheme == 'nanoc'
|
|
44
|
+
|
|
45
|
+
resolved = resolve_path(uri.path, context.from_import)
|
|
46
|
+
Addressable::URI.new({ scheme: 'nanoc', path: resolved }).to_s unless resolved.nil?
|
|
41
47
|
end
|
|
42
48
|
|
|
43
49
|
def load(url)
|
|
44
|
-
|
|
50
|
+
uri = Addressable::URI.parse(url)
|
|
51
|
+
item = @items[uri.path]
|
|
45
52
|
|
|
46
53
|
{
|
|
47
54
|
contents: item.raw_content,
|
|
@@ -51,62 +58,72 @@ module Nanoc
|
|
|
51
58
|
|
|
52
59
|
private
|
|
53
60
|
|
|
54
|
-
|
|
55
|
-
|
|
61
|
+
# https://github.com/sass-contrib/sassc-embedded-shim-ruby/blob/594632bb896fb765462253b16ea0451f5f93316d/lib/sassc/embedded.rb#L228
|
|
62
|
+
def resolve_path(path, from_import)
|
|
63
|
+
ext = File.extname(path)
|
|
64
|
+
if ext == '.*'
|
|
65
|
+
if from_import
|
|
66
|
+
result = exactly_one(try_path_with_ext("#{without_ext(path)}.import") + try_path_with_ext("#{path}.import"))
|
|
67
|
+
return result unless result.nil?
|
|
68
|
+
end
|
|
56
69
|
|
|
57
|
-
|
|
70
|
+
result = exactly_one(try_path_with_ext(without_ext(path)) + try_path_with_ext(path))
|
|
71
|
+
return result unless result.nil?
|
|
58
72
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if pat.start_with?('/')
|
|
62
|
-
pat
|
|
63
|
-
else
|
|
64
|
-
dirname = File.dirname(@source_item.identifier.to_s)
|
|
65
|
-
Nanoc::Core::Utils.expand_path_without_drive_identifier(pat, dirname)
|
|
66
|
-
end
|
|
73
|
+
return try_path_as_dir(path, from_import)
|
|
74
|
+
end
|
|
67
75
|
|
|
68
|
-
|
|
76
|
+
if ['.sass', '.scss', '.css'].include?(ext)
|
|
77
|
+
if from_import
|
|
78
|
+
result = exactly_one(try_path("#{without_ext(path)}.import#{ext}"))
|
|
79
|
+
return result unless result.nil?
|
|
80
|
+
end
|
|
81
|
+
return exactly_one(try_path(path))
|
|
82
|
+
end
|
|
69
83
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
when 0
|
|
74
|
-
raise "Could not find an item matching pattern `#{pat}`"
|
|
75
|
-
when 1
|
|
76
|
-
items.first
|
|
77
|
-
else
|
|
78
|
-
raise "It is not clear which item to import. Multiple items match `#{pat}`: #{items.map { _1.identifier.to_s }.sort.join(', ')}"
|
|
84
|
+
if from_import
|
|
85
|
+
result = exactly_one(try_path_with_ext("#{path}.import"))
|
|
86
|
+
return result unless result.nil?
|
|
79
87
|
end
|
|
80
|
-
end
|
|
81
88
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
# supporting partials and index imports.
|
|
85
|
-
def collect_items(pat, is_extension_given)
|
|
86
|
-
items = []
|
|
89
|
+
result = exactly_one(try_path_with_ext(path))
|
|
90
|
+
return result unless result.nil?
|
|
87
91
|
|
|
88
|
-
|
|
89
|
-
|
|
92
|
+
try_path_as_dir(path, from_import)
|
|
93
|
+
end
|
|
90
94
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
def try_path_with_ext(path)
|
|
96
|
+
result = try_path("#{path}.sass") + try_path("#{path}.scss")
|
|
97
|
+
result.empty? ? try_path("#{path}.css") : result
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def try_path(path)
|
|
101
|
+
partial = File.join(File.dirname(path), "_#{File.basename(path)}")
|
|
102
|
+
result = []
|
|
103
|
+
result.concat(@items.find_all(partial).map(&:identifier).map(&:to_s))
|
|
104
|
+
result.concat(@items.find_all(path).map(&:identifier).map(&:to_s))
|
|
105
|
+
result
|
|
106
|
+
end
|
|
94
107
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
108
|
+
def try_path_as_dir(path, from_import)
|
|
109
|
+
if from_import
|
|
110
|
+
result = exactly_one(try_path_with_ext(File.join(path, 'index.import')))
|
|
111
|
+
return result unless result.nil?
|
|
99
112
|
end
|
|
100
113
|
|
|
101
|
-
|
|
114
|
+
exactly_one(try_path_with_ext(File.join(path, 'index')))
|
|
102
115
|
end
|
|
103
116
|
|
|
104
|
-
def
|
|
105
|
-
if
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
117
|
+
def exactly_one(paths)
|
|
118
|
+
return if paths.empty?
|
|
119
|
+
return paths.first if paths.one?
|
|
120
|
+
|
|
121
|
+
raise "It's not clear which file to import. Found:\n#{paths.map { |path| " #{path}" }.join("\n")}"
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def without_ext(path)
|
|
125
|
+
ext = File.extname(path)
|
|
126
|
+
path.delete_suffix(ext)
|
|
110
127
|
end
|
|
111
128
|
end
|
|
112
129
|
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nanoc-dart-sass
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Denis Defreyne
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: nanoc-core
|
|
@@ -16,34 +15,28 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - "~>"
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '4.
|
|
20
|
-
- - ">="
|
|
21
|
-
- !ruby/object:Gem::Version
|
|
22
|
-
version: 4.13.1
|
|
18
|
+
version: '4.14'
|
|
23
19
|
type: :runtime
|
|
24
20
|
prerelease: false
|
|
25
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
22
|
requirements:
|
|
27
23
|
- - "~>"
|
|
28
24
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: '4.
|
|
30
|
-
- - ">="
|
|
31
|
-
- !ruby/object:Gem::Version
|
|
32
|
-
version: 4.13.1
|
|
25
|
+
version: '4.14'
|
|
33
26
|
- !ruby/object:Gem::Dependency
|
|
34
27
|
name: sass-embedded
|
|
35
28
|
requirement: !ruby/object:Gem::Requirement
|
|
36
29
|
requirements:
|
|
37
30
|
- - "~>"
|
|
38
31
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '1.
|
|
32
|
+
version: '1.80'
|
|
40
33
|
type: :runtime
|
|
41
34
|
prerelease: false
|
|
42
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
43
36
|
requirements:
|
|
44
37
|
- - "~>"
|
|
45
38
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: '1.
|
|
39
|
+
version: '1.80'
|
|
47
40
|
description: Provides a :dart_sass filter for Nanoc
|
|
48
41
|
email: denis+rubygems@denis.ws
|
|
49
42
|
executables: []
|
|
@@ -62,8 +55,7 @@ licenses:
|
|
|
62
55
|
- MIT
|
|
63
56
|
metadata:
|
|
64
57
|
rubygems_mfa_required: 'true'
|
|
65
|
-
source_code_uri: https://github.com/nanoc/nanoc/tree/nanoc-dart-sass-
|
|
66
|
-
post_install_message:
|
|
58
|
+
source_code_uri: https://github.com/nanoc/nanoc/tree/nanoc-dart-sass-v2.0.0/nanoc-dart-sass
|
|
67
59
|
rdoc_options: []
|
|
68
60
|
require_paths:
|
|
69
61
|
- lib
|
|
@@ -71,15 +63,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
71
63
|
requirements:
|
|
72
64
|
- - ">="
|
|
73
65
|
- !ruby/object:Gem::Version
|
|
74
|
-
version: '3.
|
|
66
|
+
version: '3.2'
|
|
75
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
68
|
requirements:
|
|
77
69
|
- - ">="
|
|
78
70
|
- !ruby/object:Gem::Version
|
|
79
71
|
version: '0'
|
|
80
72
|
requirements: []
|
|
81
|
-
rubygems_version:
|
|
82
|
-
signing_key:
|
|
73
|
+
rubygems_version: 4.0.3
|
|
83
74
|
specification_version: 4
|
|
84
75
|
summary: Dart Sass filter for Nanoc
|
|
85
76
|
test_files: []
|