cloudcannon-jekyll-bookshop 2.0.0.pre.beta.5 → 2.0.0.pre.beta.6
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/Gemfile.lock +1 -1
- data/lib/cloudcannon-jekyll-bookshop.rb +3 -0
- data/lib/cloudcannon-jekyll-bookshop/tags/live-tag.rb +34 -0
- data/lib/cloudcannon-jekyll-bookshop/version.rb +1 -1
- data/node_modules/@bookshop/cloudcannon-structures/package.json +2 -2
- data/node_modules/@bookshop/toml-narrator/package.json +1 -1
- 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: 458817d5d30e213affa17fc2ea232b025e0ed654289cc7194a43e6efcb5a7b57
|
4
|
+
data.tar.gz: 230c099e74778eabcdfe8a9e6afb8fc7266abeed0c9f5b1584e95d62e01cbefb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d8e756567dfe7c750a2dff25c917dd432f7b964c03daa7d10d2eaef4878853ad90ca4c34a699c538387a763eaca85ed6599d11c82487ba7bad25d39e1fd4fb8
|
7
|
+
data.tar.gz: '008884d4e82852c006718fc8121c7cd34ee244bf8172317793e95f1aa2b4daf5bfb8a1233183e91a20500bcc68d549972083bbdb14de02776ba00c3bda1468e0'
|
data/Gemfile.lock
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
require "jekyll"
|
4
4
|
require_relative "./cloudcannon-jekyll-bookshop/output-site-data"
|
5
5
|
require_relative "./cloudcannon-jekyll-bookshop/structures"
|
6
|
+
require_relative "./cloudcannon-jekyll-bookshop/tags/live-tag"
|
7
|
+
|
8
|
+
Liquid::Template.register_tag("bookshop_live", CloudCannonJekyllBookshop::LiveTag)
|
6
9
|
|
7
10
|
Jekyll::Hooks.register :site, :after_init do |site|
|
8
11
|
CloudCannonJekyllBookshop::Structures.build_structures(site)
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CloudCannonJekyllBookshop
|
4
|
+
class LiveTag < Liquid::Tag
|
5
|
+
def initialize(tag_name, markup, tokens)
|
6
|
+
super
|
7
|
+
@script = markup.strip
|
8
|
+
end
|
9
|
+
|
10
|
+
def render(context)
|
11
|
+
site = context.registers[:site]
|
12
|
+
|
13
|
+
"<script>
|
14
|
+
window.addEventListener('load', function() {
|
15
|
+
if (window.inEditorMode) {
|
16
|
+
const head = document.querySelector('head');
|
17
|
+
const script = document.createElement('script');
|
18
|
+
script.src = `/#{@script}`;
|
19
|
+
script.onload = function() {
|
20
|
+
window.bookshopLive = new window.BookshopLive();
|
21
|
+
window.CloudCannon = {
|
22
|
+
trigger: function (eventName, frontMatter) {
|
23
|
+
if (typeof frontMatter === 'string') frontMatter = JSON.parse(frontMatter);
|
24
|
+
window.bookshopLive.update({page: frontMatter});
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
head.appendChild(script);
|
29
|
+
}
|
30
|
+
});
|
31
|
+
</script>"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@bookshop/cloudcannon-structures",
|
3
|
-
"version": "2.0.0-beta.
|
3
|
+
"version": "2.0.0-beta.6",
|
4
4
|
"description": "Convert a Bookshop object into a CloudCannon structure",
|
5
5
|
"main": "main.js",
|
6
6
|
"scripts": {
|
@@ -16,7 +16,7 @@
|
|
16
16
|
"access": "public"
|
17
17
|
},
|
18
18
|
"devDependencies": {
|
19
|
-
"@bookshop/toml-narrator": "2.0.0-beta.
|
19
|
+
"@bookshop/toml-narrator": "2.0.0-beta.6",
|
20
20
|
"@ltd/j-toml": "^1.12.2",
|
21
21
|
"ava": "^3.15.0",
|
22
22
|
"nyc": "^15.1.0",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudcannon-jekyll-bookshop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.pre.beta.
|
4
|
+
version: 2.0.0.pre.beta.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Liam Bigelow
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -153,6 +153,7 @@ files:
|
|
153
153
|
- lib/cloudcannon-jekyll-bookshop/output-site-data.rb
|
154
154
|
- lib/cloudcannon-jekyll-bookshop/page-without-a-file.rb
|
155
155
|
- lib/cloudcannon-jekyll-bookshop/structures.rb
|
156
|
+
- lib/cloudcannon-jekyll-bookshop/tags/live-tag.rb
|
156
157
|
- lib/cloudcannon-jekyll-bookshop/version.rb
|
157
158
|
- node_modules/@bookshop/cloudcannon-structures/main.js
|
158
159
|
- node_modules/@bookshop/cloudcannon-structures/package.json
|