al_cookie 1.0.0 → 1.0.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 +7 -1
- data/README.md +41 -1
- data/lib/al_cookie/version.rb +1 -1
- data/lib/al_cookie.rb +16 -3
- metadata +6 -7
- data/lib/al_cookie 2.rb +0 -88
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e4ff96f323ab71770a779732634c7f2fdc0b8ae3d2b85acca8cccb1a4fbc692c
|
|
4
|
+
data.tar.gz: b93181446fd7d7962b38dd5af5083727ba2fe79f1e08cf3d1f63486c7a58c784
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 404f412ea18581aa6d347d88dadd64abec61907e7c91ba0529cc9fa7caf9d407c88c51125f7c3ed99684b0a8a526b947a3b187b073972c3a44f40c8d907181b0
|
|
7
|
+
data.tar.gz: 7221b0cca3d75665806b588b3b2ca92cb8d5f986abaf548fa76110e1d1e1504930a41d458a469c9f84071564adcf6bb8b7e93c5c242f14d39b3cbfcfb15cf259
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 1.0.1 — 2026-08-02
|
|
4
|
+
|
|
5
|
+
- Fix: the cookie-consent runtime was published to `/lib/assets/al_cookie/js/` while the script tag pointed at
|
|
6
|
+
`/assets/al_cookie/js/`, so it 404'd on every site with `enable_cookie_consent: true`. Only the default-off state
|
|
7
|
+
hid it.
|
|
8
|
+
|
|
9
|
+
## 1.0.0
|
|
4
10
|
|
|
5
11
|
- Initial extraction of cookie consent runtime from `al_folio_core` into `al_cookie`.
|
data/README.md
CHANGED
|
@@ -1,3 +1,43 @@
|
|
|
1
1
|
# al-cookie
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`al_cookie` is the cookie-consent plugin for `al-folio` v1.x.
|
|
4
|
+
|
|
5
|
+
## What it owns
|
|
6
|
+
|
|
7
|
+
- Cookie consent runtime setup and UI wiring
|
|
8
|
+
- Consent-related includes/assets previously owned by monolithic theme code
|
|
9
|
+
- Consent theme synchronization hooks used by `al-folio`
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
gem 'al_cookie'
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Enable in `_config.yml`:
|
|
18
|
+
|
|
19
|
+
```yaml
|
|
20
|
+
plugins:
|
|
21
|
+
- al_cookie
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
Render assets/scripts where your layout expects consent support:
|
|
27
|
+
|
|
28
|
+
```liquid
|
|
29
|
+
{% al_cookie_styles %}
|
|
30
|
+
{% al_cookie_scripts %}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Use your existing consent config keys in `_config.yml`.
|
|
34
|
+
|
|
35
|
+
## Ecosystem context
|
|
36
|
+
|
|
37
|
+
- Starter/orchestration: `al-folio`
|
|
38
|
+
- Theme runtime contracts: `al_folio_core`
|
|
39
|
+
- Consent gating integrations (for example analytics) are consumed via plugin boundaries.
|
|
40
|
+
|
|
41
|
+
## Contributing
|
|
42
|
+
|
|
43
|
+
Changes to consent behavior should be proposed in this repository (not `al-folio` starter), unless the change is strictly starter documentation/demo content.
|
data/lib/al_cookie/version.rb
CHANGED
data/lib/al_cookie.rb
CHANGED
|
@@ -7,7 +7,12 @@ require_relative "al_cookie/version"
|
|
|
7
7
|
module AlCookie
|
|
8
8
|
PLUGIN_ROOT = File.expand_path("..", __dir__)
|
|
9
9
|
TEMPLATES_ROOT = File.join(PLUGIN_ROOT, "lib", "templates")
|
|
10
|
-
|
|
10
|
+
# Jekyll writes a StaticFile to <dest>/<dir>/<name>, where <dir> is relative to
|
|
11
|
+
# the base passed to the constructor. That base must be lib/, not the gem root,
|
|
12
|
+
# or the runtime lands at /lib/assets/al_cookie/... while the script tag below
|
|
13
|
+
# points at /assets/al_cookie/... .
|
|
14
|
+
LIB_ROOT = __dir__
|
|
15
|
+
ASSETS_ROOT = File.join(LIB_ROOT, "assets")
|
|
11
16
|
|
|
12
17
|
class PluginStaticFile < Jekyll::StaticFile; end
|
|
13
18
|
|
|
@@ -25,6 +30,14 @@ module AlCookie
|
|
|
25
30
|
template.render(payload, registers: context.registers)
|
|
26
31
|
end
|
|
27
32
|
|
|
33
|
+
# [relative_dir, filename] for everything this gem publishes. Exposed so the
|
|
34
|
+
# destination path can be asserted without booting a full Jekyll site.
|
|
35
|
+
def asset_entries
|
|
36
|
+
Dir.glob(File.join(ASSETS_ROOT, "**", "*")).sort.reject { |p| File.directory?(p) }.map do |source_path|
|
|
37
|
+
[File.dirname(source_path).sub("#{LIB_ROOT}/", ""), File.basename(source_path)]
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
28
41
|
class AssetsGenerator < Jekyll::Generator
|
|
29
42
|
safe true
|
|
30
43
|
priority :low
|
|
@@ -35,8 +48,8 @@ module AlCookie
|
|
|
35
48
|
Dir.glob(File.join(ASSETS_ROOT, "**", "*")).sort.each do |source_path|
|
|
36
49
|
next if File.directory?(source_path)
|
|
37
50
|
|
|
38
|
-
relative_dir = File.dirname(source_path).sub("#{
|
|
39
|
-
site.static_files << PluginStaticFile.new(site,
|
|
51
|
+
relative_dir = File.dirname(source_path).sub("#{LIB_ROOT}/", "")
|
|
52
|
+
site.static_files << PluginStaticFile.new(site, LIB_ROOT, relative_dir, File.basename(source_path))
|
|
40
53
|
end
|
|
41
54
|
end
|
|
42
55
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: al_cookie
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- al-folio maintainers
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-02
|
|
11
|
+
date: 2026-08-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: jekyll
|
|
@@ -108,7 +108,6 @@ files:
|
|
|
108
108
|
- CHANGELOG.md
|
|
109
109
|
- LICENSE
|
|
110
110
|
- README.md
|
|
111
|
-
- lib/al_cookie 2.rb
|
|
112
111
|
- lib/al_cookie.rb
|
|
113
112
|
- lib/al_cookie/version.rb
|
|
114
113
|
- lib/assets/al_cookie/js/cookie-theme-sync.js
|
|
@@ -120,7 +119,7 @@ metadata:
|
|
|
120
119
|
allowed_push_host: https://rubygems.org
|
|
121
120
|
homepage_uri: https://github.com/al-org-dev/al-cookie
|
|
122
121
|
source_code_uri: https://github.com/al-org-dev/al-cookie
|
|
123
|
-
post_install_message:
|
|
122
|
+
post_install_message:
|
|
124
123
|
rdoc_options: []
|
|
125
124
|
require_paths:
|
|
126
125
|
- lib
|
|
@@ -135,8 +134,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
135
134
|
- !ruby/object:Gem::Version
|
|
136
135
|
version: '0'
|
|
137
136
|
requirements: []
|
|
138
|
-
rubygems_version: 3.
|
|
139
|
-
signing_key:
|
|
137
|
+
rubygems_version: 3.5.22
|
|
138
|
+
signing_key:
|
|
140
139
|
specification_version: 4
|
|
141
140
|
summary: Cookie consent plugin for al-folio v1.x
|
|
142
141
|
test_files: []
|
data/lib/al_cookie 2.rb
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "jekyll"
|
|
4
|
-
require "liquid"
|
|
5
|
-
require_relative "al_cookie/version"
|
|
6
|
-
|
|
7
|
-
module AlCookie
|
|
8
|
-
PLUGIN_ROOT = File.expand_path("..", __dir__)
|
|
9
|
-
TEMPLATES_ROOT = File.join(PLUGIN_ROOT, "lib", "templates")
|
|
10
|
-
ASSETS_ROOT = File.join(PLUGIN_ROOT, "lib", "assets")
|
|
11
|
-
|
|
12
|
-
class PluginStaticFile < Jekyll::StaticFile; end
|
|
13
|
-
|
|
14
|
-
module_function
|
|
15
|
-
|
|
16
|
-
def enabled?(site)
|
|
17
|
-
site.config["enable_cookie_consent"] == true
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def render_setup_script(context)
|
|
21
|
-
template_path = File.join(TEMPLATES_ROOT, "cookie_consent_setup.js.liquid")
|
|
22
|
-
template = Liquid::Template.parse(File.read(template_path))
|
|
23
|
-
payload = context.registers[:site].site_payload
|
|
24
|
-
payload["page"] = context.registers[:page] || {}
|
|
25
|
-
template.render(payload, registers: context.registers)
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
class AssetsGenerator < Jekyll::Generator
|
|
29
|
-
safe true
|
|
30
|
-
priority :low
|
|
31
|
-
|
|
32
|
-
def generate(site)
|
|
33
|
-
return unless AlCookie.enabled?(site)
|
|
34
|
-
|
|
35
|
-
Dir.glob(File.join(ASSETS_ROOT, "**", "*")).sort.each do |source_path|
|
|
36
|
-
next if File.directory?(source_path)
|
|
37
|
-
|
|
38
|
-
relative_dir = File.dirname(source_path).sub("#{PLUGIN_ROOT}/", "")
|
|
39
|
-
site.static_files << PluginStaticFile.new(site, PLUGIN_ROOT, relative_dir, File.basename(source_path))
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
class CookieStylesTag < Liquid::Tag
|
|
45
|
-
def render(context)
|
|
46
|
-
site = context.registers[:site]
|
|
47
|
-
return "" unless site && AlCookie.enabled?(site)
|
|
48
|
-
|
|
49
|
-
libs = site.config["third_party_libraries"] || {}
|
|
50
|
-
<<~HTML
|
|
51
|
-
<link
|
|
52
|
-
defer
|
|
53
|
-
rel="stylesheet"
|
|
54
|
-
href="#{libs.dig("vanilla-cookieconsent", "url", "css")}"
|
|
55
|
-
integrity="#{libs.dig("vanilla-cookieconsent", "integrity", "css")}"
|
|
56
|
-
crossorigin="anonymous"
|
|
57
|
-
>
|
|
58
|
-
HTML
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
class CookieScriptsTag < Liquid::Tag
|
|
63
|
-
def render(context)
|
|
64
|
-
site = context.registers[:site]
|
|
65
|
-
return "" unless site && AlCookie.enabled?(site)
|
|
66
|
-
|
|
67
|
-
libs = site.config["third_party_libraries"] || {}
|
|
68
|
-
baseurl = site.config["baseurl"] || ""
|
|
69
|
-
setup_script = AlCookie.render_setup_script(context)
|
|
70
|
-
|
|
71
|
-
<<~HTML
|
|
72
|
-
<script
|
|
73
|
-
defer
|
|
74
|
-
src="#{libs.dig("vanilla-cookieconsent", "url", "js")}"
|
|
75
|
-
integrity="#{libs.dig("vanilla-cookieconsent", "integrity", "js")}"
|
|
76
|
-
crossorigin="anonymous"
|
|
77
|
-
></script>
|
|
78
|
-
<script defer src="#{baseurl}/assets/al_cookie/js/cookie-theme-sync.js"></script>
|
|
79
|
-
<script>
|
|
80
|
-
#{setup_script}
|
|
81
|
-
</script>
|
|
82
|
-
HTML
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
Liquid::Template.register_tag("al_cookie_styles", AlCookie::CookieStylesTag)
|
|
88
|
-
Liquid::Template.register_tag("al_cookie_scripts", AlCookie::CookieScriptsTag)
|