nanoc-dart-sass 0.0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.md +8 -0
- data/README.md +2 -0
- data/lib/nanoc/dart_sass/filter.rb +39 -28
- data/lib/nanoc/dart_sass/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5859b27799d61ea7f72bba2904aaa0978ad43797f90fd6ab6255dba9279ef3a
|
4
|
+
data.tar.gz: c8e681f15c0617a42fabbf1d571ad2cd82aa4458087070704c36598bf9909a9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 906336b07db8e08f332f424d447f0d7a1954da7a5fbfef9d4d8a808936e5c8be92afee9786d1b22a812901d378c3a7454328a06bbb45ee0166b3bd02f8453023
|
7
|
+
data.tar.gz: c528b493cd63d3dc670a1307c2b78f41d30ca44e45420e5ef05e1f3ba6f42778e898b2f455db060c409bd2cea91c838f6667728a7e79608e397701cd07d839de
|
data/NEWS.md
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
This provides a filter that allows [Nanoc](https://nanoc.app) to process content via [Dart Sass](https://sass-lang.com/dart-sass).
|
4
4
|
|
5
|
+
This filter offers similar functionality to Nanoc’s built-in `:sass` filter. The built-in `:sass` filter, however, uses the [Ruby Sass](https://sass-lang.com/ruby-sass) implementation, which has reached end of life.
|
6
|
+
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
Add `nanoc-dart-sass` to the `nanoc` group of your Gemfile:
|
@@ -14,21 +14,11 @@ module Nanoc
|
|
14
14
|
def run(content, params = {})
|
15
15
|
# Read syntax
|
16
16
|
syntax = params[:syntax]
|
17
|
-
syntax ||=
|
18
|
-
case item.identifier.ext
|
19
|
-
when 'sass'
|
20
|
-
:indented
|
21
|
-
when 'scss'
|
22
|
-
:scss
|
23
|
-
when 'css'
|
24
|
-
:css
|
25
|
-
else
|
26
|
-
nil
|
27
|
-
end
|
17
|
+
syntax ||= Util.syntax_from_ext(item.identifier.ext)
|
28
18
|
|
29
19
|
result = Sass.compile_string(
|
30
20
|
content,
|
31
|
-
importer:
|
21
|
+
importer: NanocImporter.new(@items),
|
32
22
|
**params,
|
33
23
|
syntax: syntax,
|
34
24
|
)
|
@@ -38,23 +28,44 @@ module Nanoc
|
|
38
28
|
raise e
|
39
29
|
end
|
40
30
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
}
|
56
|
-
|
31
|
+
class NanocImporter
|
32
|
+
def initialize(items)
|
33
|
+
@items = items
|
34
|
+
end
|
35
|
+
|
36
|
+
def canonicalize(url, **)
|
37
|
+
"nanoc:#{@items[url.sub(/\Ananoc:/, '')].identifier}"
|
38
|
+
end
|
39
|
+
|
40
|
+
def load(url)
|
41
|
+
item = @items[url.sub(/\Ananoc:/, '')]
|
42
|
+
{
|
43
|
+
contents: item.raw_content,
|
44
|
+
syntax: Util.syntax_from_ext(item.identifier.ext),
|
45
|
+
}
|
46
|
+
end
|
57
47
|
end
|
48
|
+
|
49
|
+
private_constant :NanocImporter
|
50
|
+
|
51
|
+
module Util
|
52
|
+
module_function
|
53
|
+
|
54
|
+
def syntax_from_ext(ext)
|
55
|
+
case ext
|
56
|
+
when 'sass'
|
57
|
+
:indented
|
58
|
+
when 'scss'
|
59
|
+
:scss
|
60
|
+
when 'css'
|
61
|
+
:css
|
62
|
+
else
|
63
|
+
nil
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
private_constant :Util
|
58
69
|
end
|
59
70
|
end
|
60
71
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc-dart-sass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Defreyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nanoc-core
|