nanoc-dart-sass 0.0.1 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40b93740b864b61bac9b890e3076e2f52ed675d85ec815296d22a29e3d3bb1cf
4
- data.tar.gz: ccfc074b2ac62ed6172ead70e9f3c77311633885efaec81cf1b371bf45d68b51
3
+ metadata.gz: e5859b27799d61ea7f72bba2904aaa0978ad43797f90fd6ab6255dba9279ef3a
4
+ data.tar.gz: c8e681f15c0617a42fabbf1d571ad2cd82aa4458087070704c36598bf9909a9c
5
5
  SHA512:
6
- metadata.gz: 665aabe49726e3ec886549f46331d343df41341568fadbc6cd1a4273601e32e41ae1b7d03a48a973ab08745a4ae2b8929b328ef2f4196827580ab92a04a9aecc
7
- data.tar.gz: c0d0dcf3bf0ea5978886b544982e57bed7ff06649dd64e14367299f616d4915bdbd164b8a8f1b4f72bafffe5c5caebee9175656758fdfa4246998f8529a2bc69
6
+ metadata.gz: 906336b07db8e08f332f424d447f0d7a1954da7a5fbfef9d4d8a808936e5c8be92afee9786d1b22a812901d378c3a7454328a06bbb45ee0166b3bd02f8453023
7
+ data.tar.gz: c528b493cd63d3dc670a1307c2b78f41d30ca44e45420e5ef05e1f3ba6f42778e898b2f455db060c409bd2cea91c838f6667728a7e79608e397701cd07d839de
data/NEWS.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # nanoc-dart-sass news
2
2
 
3
+ ## 1.0.0 (2022-12-17)
4
+
5
+ Initial release.
6
+
7
+ Fixes:
8
+
9
+ - Apply Sass syntax detection logic to dependencies (#1630) [ntkme]
10
+
3
11
  ## 0.0.1 (2022-11-20)
4
12
 
5
13
  Initial pre-release.
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: make_dart_sass_importer(@items),
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
- private
42
-
43
- def make_dart_sass_importer(items)
44
- {
45
- canonicalize: lambda do |param, **|
46
- "nanoc:#{items[param.sub(/\Ananoc:/, '')].identifier}"
47
- end,
48
- load: lambda { |url|
49
- param = url.sub(/\Ananoc:/, '')
50
- item = items[param]
51
- return {
52
- contents: item.raw_content,
53
- syntax: item.identifier.ext,
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Nanoc
4
4
  module DartSass
5
- VERSION = '0.0.1'
5
+ VERSION = '1.0.0'
6
6
  end
7
7
  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.1
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-20 00:00:00.000000000 Z
11
+ date: 2022-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nanoc-core