bridgetown-core 2.0.0 → 2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9889270f38c2b3d048f01c752698f114a7658cc04395dd7661c72bd0b56a7192
4
- data.tar.gz: f08f67a0089dbe1cd2e2ace89b4cbff51a70caaf1d46982a0ab85982616e23bb
3
+ metadata.gz: 89df4836f5a8105ce2872c48db38dcf7f710f190e760cb7d083c4610653a6952
4
+ data.tar.gz: 54b22de4c1cf9e952c680d74fbef3f042c217bfa822a359bd8f5830e096ab8c8
5
5
  SHA512:
6
- metadata.gz: d21d3bca29c9bb0cccf17fabdd1a66a00b720e72fd1803f48e33dcb8e210f492d16a7d5a517b26b5094bde1ae0507a0f86f9496fe0af810a8e2467908066c646
7
- data.tar.gz: c5db97ee273e4f62bfeec5cb63251734bfffc6282eb87bf80a3e79e7c3b8716d5f9fee2b4233185233cae66b71da7aae93d9cab7ccbe2aeba35cd791527c5bd8
6
+ metadata.gz: b3e795be0418ead09205b2d46ab7501ba25d5df443973f4f49eaa599b2c91caad5218a279cb50385cf5dfc86146671d7a52e7bcd90631a27be9d547c5e14169e
7
+ data.tar.gz: 4045cde9174adb8d58208e7032bbac1446ba31983d9aa7853af5ec5f9194789e706ebb01a06171d0282cd0faf87827b0f222f75168cf312bc51dc23324e99256
@@ -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 = !server.using_puma?
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) }
@@ -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
- say_status :shoelace, "Installing Shoelace..."
3
+ say "Shoelace is now Web Awesome!"
4
+ say ""
4
5
 
5
- add_npm_package "@shoelace-style/shoelace"
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
@@ -107,6 +107,7 @@ module Bridgetown
107
107
  priority :highest
108
108
  input :erb
109
109
  template_engine :erb
110
+ helper_delimiters ["<%=", "%>"]
110
111
 
111
112
  # Logic to do the ERB content conversion.
112
113
  #
@@ -6,6 +6,7 @@ module Bridgetown
6
6
  priority :highest
7
7
  input :liquid
8
8
  template_engine :liquid
9
+ helper_delimiters ["{%", "%}"]
9
10
 
10
11
  attr_reader :site, :document, :layout
11
12
 
@@ -24,6 +24,7 @@ module Bridgetown
24
24
  priority :highest
25
25
  template_engine :serbea
26
26
  input :serb
27
+ helper_delimiters ["{%=", "%}"]
27
28
 
28
29
  # Logic to do the Serbea content conversion
29
30
  #
@@ -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)
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.0
4
+ version: 2.0.1
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-09-16 00:00:00.000000000 Z
11
+ date: 2025-10-03 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.0
67
+ version: 2.0.1
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.0
74
+ version: 2.0.1
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