bridgetown-core 1.1.0.beta3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: afc674e5aa40d66a2b9e4f24c0aad39108f47e70c8d4756cbfa86623ed2dc7e0
4
- data.tar.gz: 4bf462c506c3fcdd09a4750bedae19cb2ee4ff429b57a6266dd56d62645d4926
3
+ metadata.gz: e1a8e2712c8b2f218d0082a2d890bb53401efb354a055c323189bbefd1d9f9a6
4
+ data.tar.gz: 99d3049dabe2ba5e3e812240268fb754c842b1bbcf0acbe46345fbc1ada7194f
5
5
  SHA512:
6
- metadata.gz: 5baaa3f133d0e1cbd5e7e972645f107361088d9d11b5bebb38374573d898b67a07b318b4d19e1e5731a696dafe88a3b2ded6ba1c068b869e5bad750200905417
7
- data.tar.gz: 4a88c972c98f54ac8b98538fec81f907797cb423f6fa89907cab21a58c29d5961b5e6bf156a3d2846a6d2fd831656696fa9a2afd76d2c2a6f3f5b62663db2c8d
6
+ metadata.gz: d820196117aad565c3dd7150c535ccd98b08b1d4cdad4b439855ea4a2666ce58f67abe67a0b68dc40959fd3e9d7eac299bf9261a43f4ef119294549bd7a95595
7
+ data.tar.gz: 40a94f0d056e35ea8f1f34d2e0f5684ed0990ee2a2804aac4d91766d2d8ead3528dbdbbf555f14035878a1287a58cf60a70e9ffc7a60a41bcf6c1cfcf9b2bf31
@@ -48,7 +48,6 @@ module Bridgetown
48
48
  "content_engine" => "resource",
49
49
  "markdown" => "kramdown",
50
50
  "highlighter" => "rouge",
51
- "excerpt_separator" => "\n\n",
52
51
 
53
52
  # Serving
54
53
  "port" => "4000",
@@ -155,6 +154,8 @@ module Bridgetown
155
154
  raise ArgumentError,
156
155
  "No parser for '#{filename}' is available. Use a .y(a)ml or .toml file instead."
157
156
  end
157
+ rescue Psych::DisallowedClass => e
158
+ raise "Unable to parse `#{File.basename(filename)}'. #{e.message}"
158
159
  end
159
160
 
160
161
  # Public: Generate list of configuration files from the override
@@ -10,33 +10,45 @@ create_builder "purgecss.rb" do
10
10
  <<~RUBY
11
11
  class Builders::Purgecss < SiteBuilder
12
12
  def build
13
- unless config[:watch] # don't run in "watch mode"
14
- hook :site, :post_write do
15
- purgecss_file = site.in_root_dir("purgecss.config.js")
16
- unless File.exist?(purgecss_file)
17
- config_js = <<~PURGE
18
- module.exports = {
19
- content: ['frontend/javascript/*.js','./output/**/*.html'],
20
- output: "./output/_bridgetown/static/css"
21
- }
22
- PURGE
23
- File.write(purgecss_file, config_js.strip)
24
- end
25
- manifest_file = File.join(site.frontend_bundling_path, "manifest.json")
26
- if File.exist?(manifest_file)
27
- manifest = JSON.parse(File.read(manifest_file))
28
- # TODO: make this work with esbuild too
13
+ return if config[:watch] # don't run in "watch mode"
14
+
15
+ hook :site, :post_write do
16
+ purgecss_file = site.in_root_dir("purgecss.config.js")
17
+
18
+ unless File.exist?(purgecss_file)
19
+ config_js = <<~PURGE
20
+ module.exports = {
21
+ content: ['frontend/javascript/*.js','./output/**/*.html'],
22
+ output: "./output/_bridgetown/static"
23
+ }
24
+ PURGE
25
+ File.write(purgecss_file, config_js.strip)
26
+ end
27
+
28
+ manifest_file = File.join(site.frontend_bundling_path, "manifest.json")
29
+
30
+ if File.exist?(manifest_file)
31
+ manifest = JSON.parse(File.read(manifest_file))
32
+
33
+ if Bridgetown::Utils.frontend_bundler_type == :esbuild
34
+ css_file = manifest["styles/index.css"].split("/").last
35
+ css_path = ["output", "_bridgetown", "static", css_file].join("/")
36
+ else
29
37
  css_file = manifest["main.css"].split("/").last
30
38
  css_path = ["output", "_bridgetown", "static", "css", css_file].join("/")
31
- Bridgetown.logger.info "PurgeCSS", "Purging \#{css_file}"
32
- oldsize = File.stat(css_path).size / 1000
33
- system "./node_modules/.bin/purgecss -c purgecss.config.js -css \#{css_path}"
34
- newsize = File.stat(css_path).size / 1000
35
- if newsize < oldsize
36
- Bridgetown.logger.info "PurgeCSS", "Done! File size reduced from \#{oldsize}kB to \#{newsize}kB"
37
- else
38
- Bridgetown.logger.info "PurgeCSS", "Done. No apparent change in file size (\#{newsize}kB)."
39
- end
39
+ end
40
+
41
+ Bridgetown.logger.info "PurgeCSS", "Purging \#{css_file}"
42
+ oldsize = File.stat(css_path).size / 1000
43
+ system "./node_modules/.bin/purgecss -c purgecss.config.js -css \#{css_path}"
44
+ newsize = File.stat(css_path).size / 1000
45
+
46
+ if newsize < oldsize
47
+ Bridgetown.logger.info "PurgeCSS",
48
+ "Done! File size reduced from \#{oldsize}kB to \#{newsize}kB"
49
+ else
50
+ Bridgetown.logger.info "PurgeCSS",
51
+ "Done. No apparent change in file size (\#{newsize}kB)."
40
52
  end
41
53
  end
42
54
  end
@@ -4,14 +4,27 @@ say_status :shoelace, "Installing Shoelace..."
4
4
 
5
5
  run "yarn add @shoelace-style/shoelace"
6
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
+
7
22
  say 'Adding Shoelace to "frontend/javascript/index.js"...', :magenta
8
23
 
9
24
  javascript_import do
10
25
  <<~JS
11
- // Import the base Shoelace stylesheet:
12
- import "@shoelace-style/shoelace/dist/themes/light.css"
13
26
 
14
- // Example components, mix 'n' match however you like!
27
+ // Example Shoelace components. Mix 'n' match however you like!
15
28
  import "@shoelace-style/shoelace/dist/components/button/button.js"
16
29
  import "@shoelace-style/shoelace/dist/components/icon/icon.js"
17
30
  import "@shoelace-style/shoelace/dist/components/spinner/spinner.js"
@@ -45,6 +58,15 @@ else
45
58
  '"webpack-dev": "yarn shoelace:copy-assets && webpack'
46
59
  end
47
60
 
61
+ if File.exist?(".gitignore")
62
+ append_to_file ".gitignore" do
63
+ <<~FILES
64
+
65
+ src/shoelace-assets
66
+ FILES
67
+ end
68
+ end
69
+
48
70
  say_status :shoelace, "Shoelace is now configured!"
49
71
 
50
72
  say 'For further reading, check out "https://shoelace.style"', :blue
@@ -45,11 +45,13 @@ insert_into_file "Rakefile",
45
45
  JS
46
46
  end
47
47
 
48
- append_to_file ".gitignore" do
49
- <<~FILES
48
+ if File.exist?(".gitignore")
49
+ append_to_file ".gitignore" do
50
+ <<~FILES
50
51
 
51
- frontend/styles/jit-refresh.css
52
- FILES
52
+ frontend/styles/jit-refresh.css
53
+ FILES
54
+ end
53
55
  end
54
56
 
55
57
  create_builder "tailwind_jit.rb" do
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bridgetown
4
- VERSION = "1.1.0.beta3"
4
+ VERSION = "1.1.0"
5
5
  CODE_NAME = "Belmont"
6
6
  end
@@ -1,7 +1,7 @@
1
1
  <!doctype html>
2
2
  <html lang="{{ site.locale }}">
3
3
  <head>
4
- {% render "head", metadata: site.metadata, title: page.title %}
4
+ {% render "head", metadata: site.metadata, title: resource.data.title %}
5
5
  </head>
6
6
  <body class="{{ resource.data.layout }} {{ resource.data.page_class }}">
7
7
  {% render "navbar", metadata: site.metadata, resource: resource %}
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: 1.1.0.beta3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bridgetown Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-28 00:00:00.000000000 Z
11
+ date: 2022-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -608,9 +608,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
608
608
  version: 2.7.0
609
609
  required_rubygems_version: !ruby/object:Gem::Requirement
610
610
  requirements:
611
- - - ">"
611
+ - - ">="
612
612
  - !ruby/object:Gem::Version
613
- version: 1.3.1
613
+ version: '0'
614
614
  requirements: []
615
615
  rubygems_version: 3.1.4
616
616
  signing_key: