hyde-page-js 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hyde-page-js.rb +15 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eee9b1d2c569ffec0d14030836c846c6935df3f9631abf4743129774c9389e65
|
4
|
+
data.tar.gz: 7782118903c49b5f00696c5ad22d4e84738547710586fb70f2ffb49e485032d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5544c76ef9087c63bed5335d89f9a0184e650f473b7491f55bfe05ecee4e180392809f1b76c5a6c8225bb459375307c50737a8dd5f440651f0861d831adb8c7
|
7
|
+
data.tar.gz: dca9c39399445509288ce0144c277afaeacd3268fa2dc12043880e32a9fb4be548927d262cd0a46f1a50070b1aa51e8bcc635ca67253997403b2dcc8d3b0d93d
|
data/lib/hyde-page-js.rb
CHANGED
@@ -2,14 +2,18 @@ require 'terser'
|
|
2
2
|
require 'digest'
|
3
3
|
require 'jekyll'
|
4
4
|
|
5
|
-
Jekyll::Hooks.register :pages, :post_init do |page
|
5
|
+
Jekyll::Hooks.register :pages, :post_init do |page|
|
6
6
|
Hyde::Page::Js.new(page).run if page.instance_of? Jekyll::Page
|
7
7
|
end
|
8
8
|
|
9
|
+
Jekyll::Hooks.register :documents, :pre_render do |document|
|
10
|
+
Hyde::Page::Js.new(document).run if document.instance_of? Jekyll::Document
|
11
|
+
end
|
12
|
+
|
9
13
|
module Hyde
|
10
14
|
module Page
|
11
15
|
class Js
|
12
|
-
VERSION = "0.3.
|
16
|
+
VERSION = "0.3.3"
|
13
17
|
end
|
14
18
|
|
15
19
|
class GeneratedJsFile < Jekyll::StaticFile
|
@@ -66,7 +70,7 @@ module Hyde
|
|
66
70
|
js = fetch_js(@page)
|
67
71
|
layout = fetch_layout(fetch_layout_name(@page))
|
68
72
|
js_groups = parent_layout_js(layout, js).reverse
|
69
|
-
return if js_groups.empty?
|
73
|
+
return if js_groups.flatten.empty?
|
70
74
|
|
71
75
|
for group in js_groups
|
72
76
|
lookup_name = names_to_key(group)
|
@@ -74,21 +78,21 @@ module Hyde
|
|
74
78
|
|
75
79
|
if cache_entry.nil?
|
76
80
|
data = concatenate_files(group)
|
77
|
-
|
81
|
+
break if data == ""
|
78
82
|
|
79
83
|
data = minify(data)
|
80
|
-
|
84
|
+
break if data == ""
|
81
85
|
|
82
86
|
generated_file = generate_file(group, data)
|
83
87
|
|
84
|
-
# file already exists, so skip writing out the data to disk
|
85
|
-
return unless @site.static_files.find { |static_file| static_file.name == generated_file.name }.nil?
|
86
|
-
|
87
88
|
# place file data into the new file
|
88
89
|
generated_file.file_contents = data
|
89
90
|
|
90
|
-
#
|
91
|
-
@site.static_files
|
91
|
+
# file doesn't exists, so skip writing out the data to disk
|
92
|
+
if @site.static_files.find { |static_file| static_file.name == generated_file.name }.nil?
|
93
|
+
# assign static file to list for jekyll to render
|
94
|
+
@site.static_files << generated_file
|
95
|
+
end
|
92
96
|
|
93
97
|
# add to cache
|
94
98
|
cache_entry = {
|
@@ -99,7 +103,7 @@ module Hyde
|
|
99
103
|
end
|
100
104
|
|
101
105
|
# assign to site.data.js_files for liquid output
|
102
|
-
add_to_urls(cache_entry
|
106
|
+
add_to_urls(cache_entry&.fetch(:url, nil))
|
103
107
|
end
|
104
108
|
end
|
105
109
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hyde-page-js
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregory Daynes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-12-
|
11
|
+
date: 2023-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|