jekyll-bookshop 1.4.6 → 2.0.0.pre.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll-bookshop.rb +45 -5
- data/lib/jekyll-bookshop/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e50503a293fa35c489d60225d2a9839c8ad1d09020acf839f04aaadd73a857be
|
4
|
+
data.tar.gz: 54a21e0e7649fe504193193a2558e3e276ca9539e54c2b4cc115558f0ad6b7c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 441897214a67dfdcf1db45c06391484ccb9f59946094799dcaca8aa72362f8783046d5ca9bb835a132e4a84bca3af663c029449af8930e4dbdc53f27920855ce
|
7
|
+
data.tar.gz: 8664dbc2912fd38ba23004122c0b2db83d91c5c499bf1f0d7559d0c13bfc6614a28d6d336348fedad89afa4b10483e12668d8f92127feb3f232b7fdfbc84a336
|
data/lib/jekyll-bookshop.rb
CHANGED
@@ -6,7 +6,10 @@ module JekyllBookshop
|
|
6
6
|
|
7
7
|
# Look for includes in the built bookshop directory
|
8
8
|
def tag_includes_dirs(context)
|
9
|
-
|
9
|
+
bookshop_locations = context['site']['bookshop_locations']&.collect do |location|
|
10
|
+
Pathname.new(location + "/components").cleanpath.to_s
|
11
|
+
end
|
12
|
+
bookshop_locations.freeze
|
10
13
|
end
|
11
14
|
|
12
15
|
# Support the bind syntax, spreading an object into params
|
@@ -21,6 +24,8 @@ module JekyllBookshop
|
|
21
24
|
end
|
22
25
|
end
|
23
26
|
|
27
|
+
params.delete('bind')
|
28
|
+
|
24
29
|
params
|
25
30
|
end
|
26
31
|
|
@@ -53,15 +58,49 @@ module JekyllBookshop
|
|
53
58
|
end
|
54
59
|
end
|
55
60
|
|
61
|
+
class StyleTag < Liquid::Tag
|
62
|
+
def render(context)
|
63
|
+
site = context.registers[:site]
|
64
|
+
|
65
|
+
bookshop_scss_files = []
|
66
|
+
site.config['bookshop_locations']&.each do |location|
|
67
|
+
components_loc = Pathname.new(location + "/").cleanpath.to_s
|
68
|
+
scss_files = Dir.glob(components_loc + "/**/*.scss")&.collect do |scss_file|
|
69
|
+
scss_file.sub!(components_loc+"/", '').sub!(".scss", '')
|
70
|
+
end
|
71
|
+
bookshop_scss_files.push(*scss_files)
|
72
|
+
end
|
73
|
+
|
74
|
+
bookshop_scss_files = bookshop_scss_files&.collect do |file|
|
75
|
+
"@import '#{file}';"
|
76
|
+
end
|
77
|
+
|
78
|
+
output_css = if Jekyll.env == "production"
|
79
|
+
bookshop_scss_files.join("\n")
|
80
|
+
else
|
81
|
+
"html:not([data-bookshop-hmr]) {
|
82
|
+
#{bookshop_scss_files.join("\n")}
|
83
|
+
}"
|
84
|
+
end
|
85
|
+
|
86
|
+
output_css
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
56
90
|
class Styles
|
57
91
|
|
58
92
|
# Add the paths to find bookshop's styles
|
59
93
|
def self.open_bookshop(site)
|
60
|
-
|
61
|
-
|
94
|
+
bookshop_locations = site.config['bookshop_locations']&.collect do |location|
|
95
|
+
Pathname.new(location + "/").cleanpath.to_s
|
96
|
+
end
|
97
|
+
|
98
|
+
site.config['watch_dirs'] ||= [] # Paired with CloudCannon/jekyll-watch
|
99
|
+
site.config['watch_dirs'].push(*bookshop_locations);
|
100
|
+
|
62
101
|
site.config['sass'] ||= {}
|
63
102
|
site.config['sass']['load_paths'] ||= []
|
64
|
-
site.config['sass']['load_paths'].push(
|
103
|
+
site.config['sass']['load_paths'].push(*bookshop_locations)
|
65
104
|
end
|
66
105
|
end
|
67
106
|
|
@@ -87,7 +126,8 @@ module JekyllBookshop
|
|
87
126
|
end
|
88
127
|
end
|
89
128
|
|
90
|
-
Liquid::Template.register_tag("
|
129
|
+
Liquid::Template.register_tag("bookshop", JekyllBookshop::Tag)
|
130
|
+
Liquid::Template.register_tag("bookshop_scss", JekyllBookshop::StyleTag)
|
91
131
|
|
92
132
|
Liquid::Template.register_filter(JekyllBookshop::Filters)
|
93
133
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-bookshop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0.pre.alpha.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Liam Bigelow
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '5.0'
|
33
|
-
description:
|
33
|
+
description:
|
34
34
|
email:
|
35
35
|
- liam@cloudcannon.com
|
36
36
|
executables: []
|
@@ -43,7 +43,7 @@ homepage: https://github.com/cloudcannon/bookshop
|
|
43
43
|
licenses:
|
44
44
|
- MIT
|
45
45
|
metadata: {}
|
46
|
-
post_install_message:
|
46
|
+
post_install_message:
|
47
47
|
rdoc_options: []
|
48
48
|
require_paths:
|
49
49
|
- lib
|
@@ -54,12 +54,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
54
54
|
version: '0'
|
55
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- - "
|
57
|
+
- - ">"
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version:
|
59
|
+
version: 1.3.1
|
60
60
|
requirements: []
|
61
61
|
rubygems_version: 3.0.3
|
62
|
-
signing_key:
|
62
|
+
signing_key:
|
63
63
|
specification_version: 4
|
64
64
|
summary: A Jekyll plugin to load components from bookshop
|
65
65
|
test_files: []
|