jekyll-postcss 0.2.0 → 0.2.1
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/CHANGELOG.md +13 -0
- data/lib/jekyll-postcss/version.rb +1 -1
- data/lib/jekyll/converters/postcss.rb +34 -5
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d24644cb78514576747cb68fb820e064d2d8a2c0bfa536c50207f771618b127
|
4
|
+
data.tar.gz: c635127fac9be4dcb76587ac4e74f5a73cacce4695a4f6f5d21f6599c79c0b40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e619eff707df4d791cb3462e9974ff5ad1f356625bf251e202b16361e3e3830eca5c4577d4b7ea8c9b1abff2008310037d5e0eb0d96204298fbbad371c54cb59
|
7
|
+
data.tar.gz: '0414187afce84f987501b61148e91de68c2a69c46d270d9f47e241ec3fad569dd18079a27b809818778529c6a8c53d7db01d842d3542eb131fcbf96f87d66cc0'
|
data/CHANGELOG.md
ADDED
@@ -13,6 +13,7 @@ module Jekyll
|
|
13
13
|
super
|
14
14
|
|
15
15
|
@raw_cache = nil
|
16
|
+
@import_raw_cache = {}
|
16
17
|
@converted_cache = nil
|
17
18
|
end
|
18
19
|
|
@@ -27,9 +28,12 @@ module Jekyll
|
|
27
28
|
def convert(content)
|
28
29
|
raise PostCssNotFoundError unless File.file?("./node_modules/.bin/postcss")
|
29
30
|
|
30
|
-
raw_digest = Digest::MD5.hexdigest content
|
31
|
-
|
32
|
-
|
31
|
+
@raw_digest = Digest::MD5.hexdigest content
|
32
|
+
@raw_import_digests = import_digests(content)
|
33
|
+
|
34
|
+
if cache_miss.any?
|
35
|
+
@raw_cache = @raw_digest.dup
|
36
|
+
@import_raw_cache = @raw_import_digests.dup
|
33
37
|
|
34
38
|
compiled_css, status =
|
35
39
|
Open3.capture2("./node_modules/.bin/postcss", :stdin_data => content)
|
@@ -37,9 +41,34 @@ module Jekyll
|
|
37
41
|
raise PostCssRuntimeError unless status.success?
|
38
42
|
|
39
43
|
@converted_cache = compiled_css
|
40
|
-
else
|
41
|
-
@converted_cache
|
42
44
|
end
|
45
|
+
|
46
|
+
reset
|
47
|
+
|
48
|
+
@converted_cache
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def import_digests(content)
|
54
|
+
content
|
55
|
+
.scan(%r!^@import "(?<file>.*)";$!)
|
56
|
+
.flatten
|
57
|
+
.each_with_object({}) do |import, acc|
|
58
|
+
file = "#{import}.css"
|
59
|
+
acc[import] = Digest::MD5.hexdigest IO.read(file) if File.file?(file)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def cache_miss
|
64
|
+
@raw_import_digests
|
65
|
+
.map { |import, hash| @import_raw_cache[import] != hash }
|
66
|
+
.prepend(@raw_cache != @raw_digest)
|
67
|
+
end
|
68
|
+
|
69
|
+
def reset
|
70
|
+
@raw_digest = nil
|
71
|
+
@raw_import_digest = nil
|
43
72
|
end
|
44
73
|
end
|
45
74
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-postcss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mitchell Hanberg
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- ".rubocop.yml"
|
93
93
|
- ".tool-versions"
|
94
94
|
- ".travis.yml"
|
95
|
+
- CHANGELOG.md
|
95
96
|
- CODE_OF_CONDUCT.md
|
96
97
|
- Gemfile
|
97
98
|
- LICENSE.txt
|