jekyll-bookshop 1.7.1 → 2.0.0.pre.alpha.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 06aef8587a63ae477f2cbdca62841ca136714f1208336fc0d3b4f201eee52053
4
- data.tar.gz: ede4a69fe2b96f8a5417490556dc95c9880251809abe5bb81c68adfb750d2363
3
+ metadata.gz: c46fab0870b0fe3bf2f18ef2de82d603f18698c2b2e91d2dcab4a0f955d8c015
4
+ data.tar.gz: 2c3d5177e8b9f1f560cfa11cbb38bca7c882b9ef0059f8f2849fc73c926558c6
5
5
  SHA512:
6
- metadata.gz: 338ba1b82ae814a268fb7e8cb437a2df507debfa479b2efb8ae1a76e013ca5cba035c53c9246b84505f4b534cd7b7e35e10c71e478a0757310dc848b3e6a232f
7
- data.tar.gz: 0c2b53f7d5e2127531926da39bf611f74b6a5004ee2b8200466c2f16407a191762172b2d5e880d235b96dee784b791bba18a03cf3b658c7d320e5bfa4a5696b1
6
+ metadata.gz: 29560e6e5a13f36cab682805f6d97a885c5d3ec9d7f5bc1d0bff9cb374ec45e7c297077274526b82bad425024cec247bfc3c3651b10f8097011f20c426324880
7
+ data.tar.gz: 9f09c58f4b19555df6d90fb810c3170bf7a020cb9b97dbdf046731d4a555c63c724f027081316a1c2f51b5abf53d8956d136bd5a9f0ac6c683fee99d44725266
@@ -6,10 +6,10 @@ module JekyllBookshop
6
6
 
7
7
  # Look for includes in the built bookshop directory
8
8
  def tag_includes_dirs(context)
9
- Array([
10
- Pathname.new(context['site']['bookshop_theme_path'] + '/components').cleanpath.to_s,
11
- Pathname.new(context['site']['bookshop_site_path'] + '/components').cleanpath.to_s
12
- ]).freeze
9
+ bookshop_locations = context['site']['bookshop_locations']&.collect do |location|
10
+ Pathname.new(location + "/components").cleanpath.to_s
11
+ end
12
+ bookshop_locations.freeze
13
13
  end
14
14
 
15
15
  # Support the bind syntax, spreading an object into params
@@ -58,19 +58,52 @@ module JekyllBookshop
58
58
  end
59
59
  end
60
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
+
61
90
  class Styles
62
91
 
63
92
  # Add the paths to find bookshop's styles
64
93
  def self.open_bookshop(site)
65
- bookshop_theme_path = (site.theme ? site.theme.root : site.source) + '/_bookshop'
66
- bookshop_site_path = site.source + '/_bookshop'
67
- site.config['bookshop_theme_path'] = Pathname.new(bookshop_theme_path).cleanpath.to_s
68
- site.config['bookshop_site_path'] = Pathname.new(bookshop_site_path).cleanpath.to_s
94
+ bookshop_locations = site.config['bookshop_locations']&.collect do |location|
95
+ Pathname.new(location + "/").cleanpath.to_s
96
+ end
97
+ bookshop_locations = bookshop_locations.select do |location|
98
+ Dir.exist?(location)
99
+ end
100
+
101
+ site.config['watch_dirs'] ||= [] # Paired with CloudCannon/jekyll-watch
102
+ site.config['watch_dirs'].push(*bookshop_locations);
69
103
 
70
104
  site.config['sass'] ||= {}
71
105
  site.config['sass']['load_paths'] ||= []
72
- site.config['sass']['load_paths'].push(Pathname.new(bookshop_theme_path + '/sass').cleanpath.to_s)
73
- site.config['sass']['load_paths'].push(Pathname.new(bookshop_site_path + '/sass').cleanpath.to_s)
106
+ site.config['sass']['load_paths'].push(*bookshop_locations)
74
107
  end
75
108
  end
76
109
 
@@ -96,7 +129,8 @@ module JekyllBookshop
96
129
  end
97
130
  end
98
131
 
99
- Liquid::Template.register_tag("component", JekyllBookshop::Tag)
132
+ Liquid::Template.register_tag("bookshop", JekyllBookshop::Tag)
133
+ Liquid::Template.register_tag("bookshop_scss", JekyllBookshop::StyleTag)
100
134
 
101
135
  Liquid::Template.register_filter(JekyllBookshop::Filters)
102
136
 
@@ -1,3 +1,3 @@
1
1
  module JekyllBookshop
2
- VERSION = "1.7.1"
2
+ VERSION = "2.0.0.pre.alpha.4"
3
3
  end
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: 1.7.1
4
+ version: 2.0.0.pre.alpha.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liam Bigelow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-17 00:00:00.000000000 Z
11
+ date: 2021-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -54,9 +54,9 @@ 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: '0'
59
+ version: 1.3.1
60
60
  requirements: []
61
61
  rubygems_version: 3.0.3
62
62
  signing_key: