bridgetown-core 2.0.0 → 2.0.2
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/lib/bridgetown-core/commands/console.rb +1 -4
- data/lib/bridgetown-core/commands/esbuild/esbuild.defaults.js.erb +1 -1
- data/lib/bridgetown-core/commands/start.rb +1 -1
- data/lib/bridgetown-core/concerns/site/fast_refreshable.rb +1 -4
- data/lib/bridgetown-core/configuration.rb +2 -1
- data/lib/bridgetown-core/configurations/feed.rb +33 -0
- data/lib/bridgetown-core/configurations/seo.rb +33 -0
- data/lib/bridgetown-core/configurations/shoelace.rb +3 -57
- data/lib/bridgetown-core/configurations/webawesome.rb +38 -0
- data/lib/bridgetown-core/converter.rb +13 -0
- data/lib/bridgetown-core/converters/erb_templates.rb +69 -32
- data/lib/bridgetown-core/converters/liquid_templates.rb +1 -0
- data/lib/bridgetown-core/converters/serbea_templates.rb +1 -0
- data/lib/bridgetown-core/filters/url_filters.rb +8 -1
- data/lib/bridgetown-core/helpers.rb +1 -1
- data/lib/bridgetown-core/rack/boot.rb +5 -6
- data/lib/bridgetown-core/utils/loaders_manager.rb +6 -1
- data/lib/bridgetown-core/utils.rb +22 -1
- data/lib/bridgetown-core/watcher.rb +1 -6
- data/lib/site_template/package.json.erb +7 -8
- metadata +7 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c61ad30c885a073e5b971cab23538dd307ae100d1acbccf8cb62e6d773cedd7f
|
|
4
|
+
data.tar.gz: 18400fd73d5e012ac9e9e7f728aa49074d3317d4eaf0373f57925e54eba44a0c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 56d2548389959f4ab4bf8387d63b44149411beff8dcefc6ed906b53719aacb4b132399daae07691262ce0c977821d0e3e822b7b4e4abd0b3c2bc90643934807d
|
|
7
|
+
data.tar.gz: 96853e7021946b336f44f9c8160056cc9126a07d14ab621f6589477ea01f7a2833bafe3ea86f746fc947dc754a0eac0b1328fc50b942337e807e6a37731bd53f
|
|
@@ -8,10 +8,7 @@ module Bridgetown
|
|
|
8
8
|
site = Bridgetown::Current.site
|
|
9
9
|
|
|
10
10
|
I18n.reload! # make sure any locale files get read again
|
|
11
|
-
|
|
12
|
-
Bridgetown::Hooks.clear_reloadable_hooks
|
|
13
|
-
site.loaders_manager.reload_loaders
|
|
14
|
-
Bridgetown::Hooks.trigger :site, :post_reload, site
|
|
11
|
+
site.loaders_manager.reload_loaders(site)
|
|
15
12
|
|
|
16
13
|
ConsoleMethods.site_reset(site)
|
|
17
14
|
end
|
|
@@ -88,7 +88,7 @@ module Bridgetown
|
|
|
88
88
|
if server.serveable?
|
|
89
89
|
pid_tracker.create_pid_dir
|
|
90
90
|
|
|
91
|
-
bt_options.skip_live_reload
|
|
91
|
+
bt_options.skip_live_reload ||= !server.using_puma?
|
|
92
92
|
|
|
93
93
|
build_args = ["-w"] + ARGV.reject { |arg| arg == "start" }
|
|
94
94
|
build_pid = Process.fork { Bridgetown::Commands::Build.start(build_args) }
|
|
@@ -58,10 +58,7 @@ class Bridgetown::Site
|
|
|
58
58
|
if full_abort || (marked_resources.empty? && !found_gen_pages && !found_route_file)
|
|
59
59
|
# Darn, a full reload is needed (unless we're on a super-fast track)
|
|
60
60
|
if reload_if_needed
|
|
61
|
-
|
|
62
|
-
Bridgetown::Hooks.clear_reloadable_hooks
|
|
63
|
-
loaders_manager.reload_loaders
|
|
64
|
-
Bridgetown::Hooks.trigger :site, :post_reload, self, paths
|
|
61
|
+
loaders_manager.reload_loaders(self, paths)
|
|
65
62
|
process # bring out the big guns
|
|
66
63
|
end
|
|
67
64
|
return
|
|
@@ -29,9 +29,10 @@ module Bridgetown
|
|
|
29
29
|
DEFAULTS = {
|
|
30
30
|
# Where things are
|
|
31
31
|
"root_dir" => Dir.pwd,
|
|
32
|
-
"plugins_dir" => "plugins",
|
|
33
32
|
"source" => "src",
|
|
34
33
|
"destination" => "output",
|
|
34
|
+
"plugins_dir" => "plugins",
|
|
35
|
+
"server_dir" => "server",
|
|
35
36
|
"collections_dir" => "",
|
|
36
37
|
"cache_dir" => ".bridgetown-cache",
|
|
37
38
|
"layouts_dir" => "_layouts",
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
say_status :feed, "Adding bridgetown-feed gem..."
|
|
4
|
+
|
|
5
|
+
add_gem "bridgetown-feed"
|
|
6
|
+
add_initializer :"bridgetown-feed"
|
|
7
|
+
|
|
8
|
+
head_file = Dir.glob("src/**/{head.liquid,_head.erb,_head.serb}").first
|
|
9
|
+
|
|
10
|
+
unless head_file
|
|
11
|
+
say_status :feed, "Feed tags could not be automatically inserted"
|
|
12
|
+
say_status :feed, "To enable, output `feed` in the application <head> element" \
|
|
13
|
+
"using the relevant template language tags"
|
|
14
|
+
say "For further reading, check out " \
|
|
15
|
+
'"https://github.com/bridgetownrb/bridgetown-feed#readme"', :blue
|
|
16
|
+
|
|
17
|
+
return
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
say_status :feed, "Adding feed tags to #{head_file}..."
|
|
21
|
+
|
|
22
|
+
feed_tag = Bridgetown::Utils.helper_code_for_template_extname(
|
|
23
|
+
File.extname(head_file),
|
|
24
|
+
"feed_meta"
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
File.open(head_file, "a+") do |file|
|
|
28
|
+
file.write("#{feed_tag}\n") unless file.grep(%r{#{feed_tag}}).any?
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
say_status :feed, "bridgetown-feed is now configured!"
|
|
32
|
+
say "For further reading, check out " \
|
|
33
|
+
'"https://github.com/bridgetownrb/bridgetown-feed#readme"', :blue
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
say_status :seo, "Adding bridgetown-seo-tag gem..."
|
|
4
|
+
|
|
5
|
+
add_gem "bridgetown-seo-tag"
|
|
6
|
+
add_initializer :"bridgetown-seo-tag"
|
|
7
|
+
|
|
8
|
+
head_file = Dir.glob("src/**/{head.liquid,_head.erb,_head.serb}").first
|
|
9
|
+
|
|
10
|
+
unless head_file
|
|
11
|
+
say_status :seo, "SEO tags could not be automatically inserted"
|
|
12
|
+
say_status :seo, "To enable SEO, output `seo` in the application <head> element" \
|
|
13
|
+
"using the relevant template language tags"
|
|
14
|
+
say "For further reading, check out " \
|
|
15
|
+
'"https://github.com/bridgetownrb/bridgetown-seo-tag#readme"', :blue
|
|
16
|
+
|
|
17
|
+
return
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
say_status :seo, "Adding SEO tags to #{head_file}..."
|
|
21
|
+
|
|
22
|
+
seo_tag = Bridgetown::Utils.helper_code_for_template_extname(
|
|
23
|
+
File.extname(head_file),
|
|
24
|
+
"seo"
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
File.open(head_file, "a+") do |file|
|
|
28
|
+
file.write("#{seo_tag}\n") unless file.grep(%r{#{seo_tag}}).any?
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
say_status :seo, "bridgetown-seo-tag is now configured!"
|
|
32
|
+
say "For further reading, check out " \
|
|
33
|
+
'"https://github.com/bridgetownrb/bridgetown-seo-tag#readme"', :blue
|
|
@@ -1,60 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
say "Shoelace is now Web Awesome!"
|
|
4
|
+
say ""
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
stylesheet_import = <<~CSS
|
|
8
|
-
/* Import the base Shoelace stylesheet: */
|
|
9
|
-
@import "@shoelace-style/shoelace/dist/themes/light.css";
|
|
10
|
-
|
|
11
|
-
CSS
|
|
12
|
-
|
|
13
|
-
if File.exist?("frontend/styles/index.css")
|
|
14
|
-
prepend_to_file "frontend/styles/index.css", stylesheet_import
|
|
15
|
-
elsif File.exist?("frontend/styles/index.scss")
|
|
16
|
-
prepend_to_file "frontend/styles/index.scss", stylesheet_import
|
|
17
|
-
else
|
|
18
|
-
say "\nPlease add the following lines to your CSS index file:"
|
|
19
|
-
say stylesheet_import
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
say 'Adding Shoelace to "frontend/javascript/index.js"...', :magenta
|
|
23
|
-
|
|
24
|
-
javascript_import do
|
|
25
|
-
<<~JS
|
|
26
|
-
|
|
27
|
-
// Example Shoelace components. Mix 'n' match however you like!
|
|
28
|
-
import "@shoelace-style/shoelace/dist/components/button/button.js"
|
|
29
|
-
import "@shoelace-style/shoelace/dist/components/icon/icon.js"
|
|
30
|
-
import "@shoelace-style/shoelace/dist/components/spinner/spinner.js"
|
|
31
|
-
|
|
32
|
-
// Use the public icons folder:
|
|
33
|
-
import { setBasePath } from "@shoelace-style/shoelace/dist/utilities/base-path.js"
|
|
34
|
-
setBasePath("/shoelace-assets")
|
|
35
|
-
JS
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
say "Updating frontend build commands...", :magenta
|
|
39
|
-
|
|
40
|
-
insert_into_file "package.json", before: ' "esbuild": "node' do
|
|
41
|
-
<<-JS
|
|
42
|
-
"shoelace:copy-assets": "mkdir -p src/shoelace-assets && cp -r node_modules/@shoelace-style/shoelace/dist/assets src/shoelace-assets",
|
|
43
|
-
JS
|
|
44
|
-
end
|
|
45
|
-
gsub_file "package.json", %r{"esbuild": "node}, '"esbuild": "npm run shoelace:copy-assets && node'
|
|
46
|
-
gsub_file "package.json", %r{"esbuild-dev": "node},
|
|
47
|
-
'"esbuild-dev": "npm run shoelace:copy-assets && node'
|
|
48
|
-
|
|
49
|
-
if File.exist?(".gitignore")
|
|
50
|
-
append_to_file ".gitignore" do
|
|
51
|
-
<<~FILES
|
|
52
|
-
|
|
53
|
-
src/shoelace-assets
|
|
54
|
-
FILES
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
say_status :shoelace, "Shoelace is now configured!"
|
|
59
|
-
|
|
60
|
-
say 'For further reading, check out "https://shoelace.style"', :blue
|
|
6
|
+
Bridgetown::Commands::Configure.start(["webawesome"])
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
say_status :webawesome, "Installing Web Awesome..."
|
|
4
|
+
|
|
5
|
+
add_npm_package "@awesome.me/webawesome"
|
|
6
|
+
|
|
7
|
+
stylesheet_import = <<~CSS
|
|
8
|
+
/* Import the base Web Awesome stylesheet: */
|
|
9
|
+
@import "@awesome.me/webawesome/dist/styles/webawesome.css";
|
|
10
|
+
|
|
11
|
+
CSS
|
|
12
|
+
|
|
13
|
+
if File.exist?("frontend/styles/index.css")
|
|
14
|
+
say 'Adding Web Awesome stylesheet import to "frontend/styles/index.css"...', :magenta
|
|
15
|
+
prepend_to_file "frontend/styles/index.css", stylesheet_import
|
|
16
|
+
elsif File.exist?("frontend/styles/index.scss")
|
|
17
|
+
say 'Adding Web Awesome stylesheet import to "frontend/styles/index.scss"...', :magenta
|
|
18
|
+
prepend_to_file "frontend/styles/index.scss", stylesheet_import
|
|
19
|
+
else
|
|
20
|
+
say "\nPlease add the following lines to your CSS index file:"
|
|
21
|
+
say stylesheet_import
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
say 'Adding Web Awesome component imports to "frontend/javascript/index.js"...', :magenta
|
|
25
|
+
|
|
26
|
+
javascript_import do
|
|
27
|
+
<<~JS
|
|
28
|
+
|
|
29
|
+
// Example Web Awesome components. Mix 'n' match however you like!
|
|
30
|
+
import "@awesome.me/webawesome/dist/components/button/button.js"
|
|
31
|
+
import "@awesome.me/webawesome/dist/components/icon/icon.js"
|
|
32
|
+
import "@awesome.me/webawesome/dist/components/spinner/spinner.js"
|
|
33
|
+
JS
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
say_status :webawesome, "Web Awesome is now configured!"
|
|
37
|
+
|
|
38
|
+
say 'For further reading, check out "https://webawesome.com"', :blue
|
|
@@ -9,12 +9,25 @@ module Bridgetown
|
|
|
9
9
|
#
|
|
10
10
|
# * `input :erb`
|
|
11
11
|
# * `input %i(xls xlsx)`
|
|
12
|
+
#
|
|
13
|
+
# @param extnames [Array<Symbol>] extensions
|
|
12
14
|
def input(extnames)
|
|
13
15
|
extnames = Array(extnames)
|
|
14
16
|
self.extname_list ||= []
|
|
15
17
|
self.extname_list += extnames.map { |e| ".#{e.to_s.downcase}" }
|
|
16
18
|
end
|
|
17
19
|
|
|
20
|
+
# Set or return the delimiters used for helper calls in template code
|
|
21
|
+
# (e.g. `["<%=", "%>"]` for ERB). This is purely informational for the framework's benefit,
|
|
22
|
+
# not used within a rendering pipeline.
|
|
23
|
+
#
|
|
24
|
+
# @param delimiters [Array<String>] delimiters
|
|
25
|
+
def helper_delimiters(delimiters = nil)
|
|
26
|
+
return @helper_delimiters if delimiters.nil?
|
|
27
|
+
|
|
28
|
+
@helper_delimiters = delimiters
|
|
29
|
+
end
|
|
30
|
+
|
|
18
31
|
def supports_slots? = @support_slots
|
|
19
32
|
|
|
20
33
|
def support_slots(bool = true) # rubocop:disable Style/OptionalBooleanParameter
|
|
@@ -1,63 +1,98 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "tilt/erubi"
|
|
4
|
+
require "erubi/capture_block"
|
|
4
5
|
|
|
5
6
|
module Bridgetown
|
|
6
|
-
class OutputBuffer
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
class OutputBuffer
|
|
8
|
+
extend Forwardable
|
|
9
|
+
|
|
10
|
+
def_delegators :@buffer,
|
|
11
|
+
:empty?,
|
|
12
|
+
:encode,
|
|
13
|
+
:encode!,
|
|
14
|
+
:encoding,
|
|
15
|
+
:force_encoding,
|
|
16
|
+
:length,
|
|
17
|
+
:lines,
|
|
18
|
+
:reverse,
|
|
19
|
+
:strip,
|
|
20
|
+
:valid_encoding?
|
|
21
|
+
|
|
22
|
+
def initialize(buffer = "")
|
|
23
|
+
@buffer = String.new(buffer)
|
|
24
|
+
@buffer.encode!
|
|
10
25
|
end
|
|
11
26
|
|
|
27
|
+
def initialize_copy(other)
|
|
28
|
+
@buffer = other.to_str
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Concatenation for <%= %> expressions, whose output is escaped.
|
|
12
32
|
def <<(value)
|
|
13
33
|
return self if value.nil?
|
|
14
34
|
|
|
15
|
-
|
|
35
|
+
value = value.to_s
|
|
36
|
+
value = Erubi.h(value) unless value.html_safe?
|
|
37
|
+
|
|
38
|
+
@buffer << value
|
|
39
|
+
|
|
40
|
+
self
|
|
16
41
|
end
|
|
17
42
|
alias_method :append=, :<<
|
|
18
43
|
|
|
44
|
+
# Concatenation for <%== %> expressions, whose output is not escaped.
|
|
45
|
+
#
|
|
46
|
+
# rubocop:disable Naming/BinaryOperatorParameterName
|
|
47
|
+
def |(value)
|
|
48
|
+
return self if value.nil?
|
|
49
|
+
|
|
50
|
+
safe_concat(value.to_s)
|
|
51
|
+
end
|
|
52
|
+
# rubocop:enable Naming/BinaryOperatorParameterName
|
|
53
|
+
|
|
54
|
+
def ==(other)
|
|
55
|
+
other.instance_of?(OutputBuffer) &&
|
|
56
|
+
@buffer == other.to_str
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def html_safe?
|
|
60
|
+
true
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def html_safe = to_s
|
|
64
|
+
|
|
65
|
+
def safe_concat(value)
|
|
66
|
+
@buffer << value
|
|
67
|
+
self
|
|
68
|
+
end
|
|
69
|
+
alias_method :safe_append=, :safe_concat
|
|
70
|
+
|
|
19
71
|
def safe_expr_append=(val)
|
|
20
72
|
return self if val.nil? # rubocop:disable Lint/ReturnInVoidContext
|
|
21
73
|
|
|
22
74
|
safe_concat val.to_s
|
|
23
75
|
end
|
|
24
76
|
|
|
25
|
-
|
|
77
|
+
def to_s
|
|
78
|
+
@buffer.html_safe
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def to_str
|
|
82
|
+
@buffer.dup
|
|
83
|
+
end
|
|
26
84
|
end
|
|
27
85
|
|
|
28
|
-
class ERBEngine < Erubi::
|
|
86
|
+
class ERBEngine < Erubi::CaptureBlockEngine
|
|
29
87
|
private
|
|
30
88
|
|
|
31
|
-
def add_code(code)
|
|
32
|
-
@src << code
|
|
33
|
-
@src << ";#{@bufvar};" if code.strip.split(".").first == "end"
|
|
34
|
-
@src << ";" unless code[Erubi::RANGE_LAST] == "\n"
|
|
35
|
-
end
|
|
36
|
-
|
|
37
89
|
def add_text(text)
|
|
38
90
|
return if text.empty?
|
|
39
91
|
|
|
40
|
-
src << bufvar << ".
|
|
92
|
+
src << bufvar << ".safe_concat'"
|
|
41
93
|
src << text.gsub(%r{['\\]}, '\\\\\&')
|
|
42
94
|
src << "'.freeze;"
|
|
43
95
|
end
|
|
44
|
-
|
|
45
|
-
# pulled from Rails' ActionView
|
|
46
|
-
BLOCK_EXPR = %r!\s*((\s+|\))do|\{)(\s*\|[^|]*\|)?\s*\Z!
|
|
47
|
-
|
|
48
|
-
def add_expression(indicator, code)
|
|
49
|
-
src << bufvar << if (indicator == "==") || @escape
|
|
50
|
-
".safe_expr_append="
|
|
51
|
-
else
|
|
52
|
-
".append="
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
if BLOCK_EXPR.match?(code)
|
|
56
|
-
src << " " << code
|
|
57
|
-
else
|
|
58
|
-
src << "(" << code << ");"
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
96
|
end
|
|
62
97
|
|
|
63
98
|
module ERBCapture
|
|
@@ -67,8 +102,9 @@ module Bridgetown
|
|
|
67
102
|
result = yield(*args)
|
|
68
103
|
result = @_erbout.presence || result
|
|
69
104
|
@_erbout = previous_buffer_state
|
|
105
|
+
return result.to_s if result.is_a?(OutputBuffer)
|
|
70
106
|
|
|
71
|
-
result.is_a?(String) ?
|
|
107
|
+
result.is_a?(String) ? Erubi.h(result) : result
|
|
72
108
|
end
|
|
73
109
|
end
|
|
74
110
|
|
|
@@ -107,6 +143,7 @@ module Bridgetown
|
|
|
107
143
|
priority :highest
|
|
108
144
|
input :erb
|
|
109
145
|
template_engine :erb
|
|
146
|
+
helper_delimiters ["<%=", "%>"]
|
|
110
147
|
|
|
111
148
|
# Logic to do the ERB content conversion.
|
|
112
149
|
#
|
|
@@ -70,7 +70,14 @@ module Bridgetown
|
|
|
70
70
|
# @return [String]
|
|
71
71
|
def strip_extname(input)
|
|
72
72
|
Pathname.new(input.to_s).then do |path|
|
|
73
|
-
|
|
73
|
+
basename = path.basename
|
|
74
|
+
while basename.to_s.include?(".")
|
|
75
|
+
new_basename = basename.basename(".*")
|
|
76
|
+
break if new_basename == basename
|
|
77
|
+
|
|
78
|
+
basename = new_basename
|
|
79
|
+
end
|
|
80
|
+
path.dirname + basename
|
|
74
81
|
end.to_s
|
|
75
82
|
end
|
|
76
83
|
|
|
@@ -154,7 +154,7 @@ module Bridgetown
|
|
|
154
154
|
|
|
155
155
|
if key&.start_with?(".")
|
|
156
156
|
view_path = Bridgetown::Filters::URLFilters.strip_extname(view.resource.relative_path)
|
|
157
|
-
key = "#{view_path.tr("
|
|
157
|
+
key = "#{view_path.tr("/", ".").lstrip.delete_prefix("_")}#{key}"
|
|
158
158
|
end
|
|
159
159
|
|
|
160
160
|
return I18n.translate(key, **options) unless %r{(?:_|\b)html\z}.match?(key)
|
|
@@ -22,12 +22,11 @@ module Bridgetown
|
|
|
22
22
|
# Roda app is provided the preloaded Bridgetown site configuration. Handle
|
|
23
23
|
# any uncaught Roda errors.
|
|
24
24
|
def self.boot(*)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
)
|
|
25
|
+
config = Bridgetown::Current.preloaded_configuration
|
|
26
|
+
self.loaders_manager = Bridgetown::Utils::LoadersManager.new(config)
|
|
27
|
+
|
|
28
|
+
config.run_initializers! context: :server
|
|
29
|
+
LoaderHooks.autoload_server_folder(File.join(config.root_dir, config.server_dir))
|
|
31
30
|
end
|
|
32
31
|
end
|
|
33
32
|
end
|
|
@@ -61,7 +61,10 @@ module Bridgetown
|
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
-
def reload_loaders
|
|
64
|
+
def reload_loaders(site, paths = [])
|
|
65
|
+
Bridgetown::Hooks.trigger :site, :pre_reload, site, paths
|
|
66
|
+
Bridgetown::Hooks.clear_reloadable_hooks
|
|
67
|
+
|
|
65
68
|
FileUtils.rm_f(Bridgetown.build_errors_path)
|
|
66
69
|
|
|
67
70
|
@loaders.each do |load_path, loader|
|
|
@@ -72,6 +75,8 @@ module Bridgetown
|
|
|
72
75
|
loader.eager_load if config.eager_load_paths.include?(load_path)
|
|
73
76
|
Bridgetown::Hooks.trigger :loader, :post_reload, loader, load_path
|
|
74
77
|
end
|
|
78
|
+
|
|
79
|
+
Bridgetown::Hooks.trigger :site, :post_reload, site, paths
|
|
75
80
|
end
|
|
76
81
|
end
|
|
77
82
|
end
|
|
@@ -116,7 +116,7 @@ module Bridgetown
|
|
|
116
116
|
raise Errors::InvalidDateError, "Invalid date '#{input}': #{msg}"
|
|
117
117
|
end
|
|
118
118
|
|
|
119
|
-
# Determines whether a given file has
|
|
119
|
+
# Determines whether a given file has YAML front matter
|
|
120
120
|
#
|
|
121
121
|
# @return [Boolean] if the YAML front matter is present.
|
|
122
122
|
def has_yaml_header?(file) # rubocop: disable Naming/PredicateName
|
|
@@ -485,6 +485,27 @@ module Bridgetown
|
|
|
485
485
|
%(<template shadowrootmode="#{shadow_root_mode}">#{input}</template>).html_safe
|
|
486
486
|
end
|
|
487
487
|
|
|
488
|
+
def helper_code_for_template_extname(extname, content)
|
|
489
|
+
template_engines_providing_delimiters =
|
|
490
|
+
Bridgetown::Converter.subclasses
|
|
491
|
+
.filter_map do |converter|
|
|
492
|
+
[converter, converter.extname_list] if converter.helper_delimiters
|
|
493
|
+
end.to_h
|
|
494
|
+
found_template_engine =
|
|
495
|
+
template_engines_providing_delimiters.find do |_, extnames|
|
|
496
|
+
extnames.include?(extname)
|
|
497
|
+
end&.first
|
|
498
|
+
|
|
499
|
+
unless found_template_engine
|
|
500
|
+
raise "No template engine using file extension #{extname}" \
|
|
501
|
+
"is currently supported for code generation"
|
|
502
|
+
end
|
|
503
|
+
|
|
504
|
+
start_tag, end_tag = found_template_engine.helper_delimiters
|
|
505
|
+
|
|
506
|
+
[start_tag, content, end_tag].join(" ")
|
|
507
|
+
end
|
|
508
|
+
|
|
488
509
|
private
|
|
489
510
|
|
|
490
511
|
def merge_values(target, overwrite)
|
|
@@ -101,12 +101,7 @@ module Bridgetown
|
|
|
101
101
|
I18n.reload! # make sure any locale files get read again
|
|
102
102
|
Bridgetown::Current.sites[site.label] = site # needed in SSR mode apparently
|
|
103
103
|
catch :halt do
|
|
104
|
-
unless fast_refreshable
|
|
105
|
-
Bridgetown::Hooks.trigger :site, :pre_reload, site, paths
|
|
106
|
-
Bridgetown::Hooks.clear_reloadable_hooks
|
|
107
|
-
site.loaders_manager.reload_loaders
|
|
108
|
-
Bridgetown::Hooks.trigger :site, :post_reload, site, paths
|
|
109
|
-
end
|
|
104
|
+
site.loaders_manager.reload_loaders(site, paths) unless fast_refreshable
|
|
110
105
|
|
|
111
106
|
if site.ssr?
|
|
112
107
|
site.reset(soft: true)
|
|
@@ -8,19 +8,18 @@
|
|
|
8
8
|
"esbuild-dev": "node esbuild.config.js --watch"
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
11
|
-
"esbuild": "^0.
|
|
12
|
-
"glob": "^
|
|
11
|
+
"esbuild": "^0.25.11",
|
|
12
|
+
"glob": "^11.0.3",
|
|
13
13
|
<%- unless disable_postcss? -%>
|
|
14
|
-
"postcss": "^8.
|
|
14
|
+
"postcss": "^8.5.6",
|
|
15
15
|
"postcss-flexbugs-fixes": "^5.0.2",
|
|
16
|
-
"postcss-import": "^
|
|
17
|
-
"postcss-load-config": "^
|
|
18
|
-
"postcss-preset-env": "^
|
|
16
|
+
"postcss-import": "^16.1.0",
|
|
17
|
+
"postcss-load-config": "^6.0.1",
|
|
18
|
+
"postcss-preset-env": "^10.4.0",
|
|
19
19
|
"read-cache": "^1.0.0"<%= "," unless postcss_option %>
|
|
20
20
|
<%- end -%>
|
|
21
21
|
<%- unless postcss_option -%>
|
|
22
|
-
"sass": "^1.
|
|
23
|
-
"sass-loader": "^13.3.2"
|
|
22
|
+
"sass": "^1.93.2"
|
|
24
23
|
<%- end -%>
|
|
25
24
|
}
|
|
26
25
|
}
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bridgetown-core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
4
|
+
version: 2.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bridgetown Team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-10-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -64,14 +64,14 @@ dependencies:
|
|
|
64
64
|
requirements:
|
|
65
65
|
- - '='
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: 2.0.
|
|
67
|
+
version: 2.0.2
|
|
68
68
|
type: :runtime
|
|
69
69
|
prerelease: false
|
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
|
71
71
|
requirements:
|
|
72
72
|
- - '='
|
|
73
73
|
- !ruby/object:Gem::Version
|
|
74
|
-
version: 2.0.
|
|
74
|
+
version: 2.0.2
|
|
75
75
|
- !ruby/object:Gem::Dependency
|
|
76
76
|
name: csv
|
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -463,6 +463,7 @@ files:
|
|
|
463
463
|
- lib/bridgetown-core/configurations/cypress/cypress_dir/support/commands.js
|
|
464
464
|
- lib/bridgetown-core/configurations/cypress/cypress_dir/support/index.js
|
|
465
465
|
- lib/bridgetown-core/configurations/cypress/cypress_tasks
|
|
466
|
+
- lib/bridgetown-core/configurations/feed.rb
|
|
466
467
|
- lib/bridgetown-core/configurations/gh-pages.rb
|
|
467
468
|
- lib/bridgetown-core/configurations/gh-pages/gh-pages.yml
|
|
468
469
|
- lib/bridgetown-core/configurations/is-land.rb
|
|
@@ -482,6 +483,7 @@ files:
|
|
|
482
483
|
- lib/bridgetown-core/configurations/ruby2js.rb
|
|
483
484
|
- lib/bridgetown-core/configurations/ruby2js/hello_world.js.rb
|
|
484
485
|
- lib/bridgetown-core/configurations/ruby2js/ruby2js.rb
|
|
486
|
+
- lib/bridgetown-core/configurations/seo.rb
|
|
485
487
|
- lib/bridgetown-core/configurations/shoelace.rb
|
|
486
488
|
- lib/bridgetown-core/configurations/stimulus.rb
|
|
487
489
|
- lib/bridgetown-core/configurations/tailwindcss.rb
|
|
@@ -490,6 +492,7 @@ files:
|
|
|
490
492
|
- lib/bridgetown-core/configurations/vercel.rb
|
|
491
493
|
- lib/bridgetown-core/configurations/vercel/vercel.json
|
|
492
494
|
- lib/bridgetown-core/configurations/vercel/vercel_url.rb
|
|
495
|
+
- lib/bridgetown-core/configurations/webawesome.rb
|
|
493
496
|
- lib/bridgetown-core/converter.rb
|
|
494
497
|
- lib/bridgetown-core/converters/erb_templates.rb
|
|
495
498
|
- lib/bridgetown-core/converters/identity.rb
|