bridgetown-core 0.21.0 → 0.21.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/lib/bridgetown-core.rb +10 -1
- data/lib/bridgetown-core/collection.rb +11 -6
- data/lib/bridgetown-core/commands/concerns/build_options.rb +2 -2
- data/lib/bridgetown-core/commands/serve.rb +1 -1
- data/lib/bridgetown-core/commands/webpack.rb +8 -1
- data/lib/bridgetown-core/commands/webpack/update.rb +21 -0
- data/lib/bridgetown-core/commands/webpack/webpack.config.js +15 -2
- data/lib/bridgetown-core/commands/webpack/webpack.defaults.js.erb +87 -91
- data/lib/bridgetown-core/concerns/site/configurable.rb +16 -1
- data/lib/bridgetown-core/configuration.rb +1 -1
- data/lib/bridgetown-core/configurations/tailwindcss.rb +8 -3
- data/lib/bridgetown-core/configurations/tailwindcss/postcss.config.js +2 -2
- data/lib/bridgetown-core/drops/resource_drop.rb +2 -1
- data/lib/bridgetown-core/drops/site_drop.rb +2 -0
- data/lib/bridgetown-core/filters/url_filters.rb +4 -8
- data/lib/bridgetown-core/resource/base.rb +10 -0
- data/lib/bridgetown-core/resource/destination.rb +3 -1
- data/lib/bridgetown-core/resource/permalink_processor.rb +7 -3
- data/lib/bridgetown-core/site.rb +1 -1
- data/lib/bridgetown-core/static_file.rb +3 -2
- data/lib/bridgetown-core/utils.rb +1 -1
- data/lib/bridgetown-core/version.rb +1 -1
- data/lib/site_template/bridgetown.config.yml +5 -1
- data/lib/site_template/package.json.erb +6 -9
- data/lib/site_template/src/_data/site_metadata.yml +1 -1
- 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: e3ba931e1d2393d0b13861c33e41c465a4e422baac0f9a68e39699b8159a2c5c
|
4
|
+
data.tar.gz: ff03f8af4f51257689ec84b0b661b0ba22ceb16a9110c5715aab56645020219c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82407b17c101d072436853bb2892108b544d91d2667dbdef36696d674ce3af18a123920f0e33dd3acce352bf7ad48c9df162c03aba977d7dad2a23ad1dfbc20e
|
7
|
+
data.tar.gz: 6c6c47fbf536cf3e3104040ce480be88183b60df5220845fe8a163af32de700b9f358c9d2bf58d19985da42d66e4005765c3d47a5e3c29def6039f77a640447b
|
data/lib/bridgetown-core.rb
CHANGED
@@ -257,7 +257,16 @@ end
|
|
257
257
|
|
258
258
|
module Bridgetown
|
259
259
|
module Model; end
|
260
|
-
module Resource
|
260
|
+
module Resource
|
261
|
+
def self.register_extension(mod)
|
262
|
+
if mod.const_defined?(:LiquidResource)
|
263
|
+
Bridgetown::Drops::ResourceDrop.include mod.const_get(:LiquidResource)
|
264
|
+
end
|
265
|
+
if mod.const_defined?(:RubyResource)
|
266
|
+
Bridgetown::Resource::Base.include mod.const_get(:RubyResource)
|
267
|
+
end
|
268
|
+
end
|
269
|
+
end
|
261
270
|
end
|
262
271
|
|
263
272
|
# This method is available in Ruby 3, monkey patching for older versions
|
@@ -242,7 +242,7 @@ module Bridgetown
|
|
242
242
|
site.config.collections[label] || HashWithDotAccess::Hash.new
|
243
243
|
end
|
244
244
|
|
245
|
-
def merge_data_resources
|
245
|
+
def merge_data_resources # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
|
246
246
|
data_contents = {}
|
247
247
|
|
248
248
|
sanitize_filename = ->(name) do
|
@@ -256,11 +256,16 @@ module Bridgetown
|
|
256
256
|
segments.each_with_index do |segment, index|
|
257
257
|
sanitized_segment = sanitize_filename.(File.basename(segment, ".*"))
|
258
258
|
hsh = nested.empty? ? data_contents : data_contents.dig(*nested)
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
259
|
+
if !hsh.is_a?(Hash)
|
260
|
+
Bridgetown.logger.error(
|
261
|
+
"Error:",
|
262
|
+
"#{nested.join("/")} is not a Hash structure, #{segment} cannot be read"
|
263
|
+
)
|
264
|
+
elsif index == segments.length - 1
|
265
|
+
hsh[sanitized_segment] = data_resource.data.rows || data_resource.data
|
266
|
+
elsif !hsh.key?(sanitized_segment)
|
267
|
+
hsh[sanitized_segment] = {}
|
268
|
+
end
|
264
269
|
nested << sanitized_segment
|
265
270
|
end
|
266
271
|
end
|
@@ -36,9 +36,9 @@ module Bridgetown
|
|
36
36
|
klass.class_option :limit_posts,
|
37
37
|
type: :numeric,
|
38
38
|
desc: "Limits the number of posts to parse and publish"
|
39
|
-
klass.class_option :
|
39
|
+
klass.class_option :base_path,
|
40
40
|
aliases: "-b",
|
41
|
-
desc: "Serve the website from the given base
|
41
|
+
desc: "Serve the website from the given base path"
|
42
42
|
klass.class_option :force_polling,
|
43
43
|
type: :boolean,
|
44
44
|
desc: "Force watch to use polling"
|
@@ -119,7 +119,7 @@ module Bridgetown
|
|
119
119
|
|
120
120
|
def start_up_webrick(opts, destination)
|
121
121
|
@server = WEBrick::HTTPServer.new(webrick_opts(opts)).tap { |o| o.unmount("") }
|
122
|
-
@server.mount(opts["
|
122
|
+
@server.mount(opts["base_path"].to_s, Servlet, destination, file_handler_opts)
|
123
123
|
|
124
124
|
Bridgetown.logger.info "Server address:", server_address(@server, opts)
|
125
125
|
launch_browser @server, opts if opts["open_url"]
|
@@ -41,11 +41,18 @@ module Bridgetown
|
|
41
41
|
config.root_dir
|
42
42
|
end
|
43
43
|
|
44
|
+
protected
|
45
|
+
|
44
46
|
def config
|
45
47
|
@config ||= Bridgetown.configuration({ root_dir: Dir.pwd })
|
46
48
|
end
|
47
49
|
|
48
|
-
|
50
|
+
def package_json
|
51
|
+
@package_json ||= begin
|
52
|
+
package_json_file = File.read(Bridgetown.sanitized_path(config.root_dir, "package.json"))
|
53
|
+
JSON.parse(package_json_file)
|
54
|
+
end
|
55
|
+
end
|
49
56
|
|
50
57
|
def perform(action)
|
51
58
|
automation = find_in_source_paths("#{action}.rb")
|
@@ -1,3 +1,24 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# rubocop:disable Layout/LineLength
|
4
|
+
|
5
|
+
required_packages = %w(esbuild esbuild-loader webpack@5.39.1 webpack-cli@4.7.2 webpack-manifest-plugin@3.1.1)
|
6
|
+
redundant_packages = %w(@babel/core @babel/plugin-proposal-class-properties @babel/plugin-proposal-decorators @babel/plugin-transform-runtime @babel/preset-env babel-loader)
|
7
|
+
|
3
8
|
template "webpack.defaults.js.erb", "config/webpack.defaults.js", force: true
|
9
|
+
say "🎉 Webpack configuration updated successfully!"
|
10
|
+
|
11
|
+
return if Bridgetown.environment.test?
|
12
|
+
|
13
|
+
say "Installing required packages"
|
14
|
+
run "yarn add -D #{required_packages.join(" ")}"
|
15
|
+
|
16
|
+
packages_to_remove = package_json["devDependencies"].slice(*redundant_packages).keys
|
17
|
+
unless packages_to_remove.empty?
|
18
|
+
confirm = ask "\nThe following packages will be removed: \n\n#{packages_to_remove.join("\n")}\n\nWould you like to continue? [Yn]"
|
19
|
+
return unless confirm.casecmp?("Y")
|
20
|
+
|
21
|
+
run "yarn remove #{packages_to_remove.join(" ")}"
|
22
|
+
end
|
23
|
+
|
24
|
+
# rubocop:enable Layout/LineLength
|
@@ -1,7 +1,9 @@
|
|
1
|
-
const
|
1
|
+
const { merge } = require('webpack-merge')
|
2
2
|
|
3
|
-
|
3
|
+
var config = require("./config/webpack.defaults.js")
|
4
4
|
|
5
|
+
// Add any overrides to the default webpack config here:
|
6
|
+
//
|
5
7
|
// Eg:
|
6
8
|
//
|
7
9
|
// ```
|
@@ -9,6 +11,17 @@ const config = require("./config/webpack.defaults.js")
|
|
9
11
|
// config.resolve.modules.push(path.resolve(__dirname, 'frontend', 'components'))
|
10
12
|
// config.resolve.alias.frontendComponents = path.resolve(__dirname, 'frontend', 'components')
|
11
13
|
// ```
|
14
|
+
//
|
15
|
+
// You can also merge in a custom config using the included `webpack-merge` package.
|
16
|
+
// Complete docs available at: https://github.com/survivejs/webpack-merge
|
17
|
+
//
|
18
|
+
// Eg:
|
19
|
+
//
|
20
|
+
// ```
|
21
|
+
// const customConfig = { ..... }
|
22
|
+
// config = merge(config, customConfig)
|
23
|
+
// ```
|
24
|
+
|
12
25
|
|
13
26
|
|
14
27
|
|
@@ -11,12 +11,89 @@
|
|
11
11
|
const path = require("path");
|
12
12
|
const rootDir = path.resolve(__dirname, "..")
|
13
13
|
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
14
|
-
const
|
14
|
+
const { WebpackManifestPlugin } = require("webpack-manifest-plugin");
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
// Input and output
|
17
|
+
|
18
|
+
const entry = { main: path.resolve(rootDir, "frontend", "javascript", "index.js") }
|
19
|
+
const output = {
|
20
|
+
path: path.resolve(rootDir, "output", "_bridgetown", "static", "js"),
|
21
|
+
filename: "[name].[contenthash].js",
|
22
|
+
publicPath: "",
|
23
|
+
}
|
24
|
+
|
25
|
+
// Rules and Loaders
|
26
|
+
|
27
|
+
const jsRule = {
|
28
|
+
test: /\.(js|jsx)/,
|
29
|
+
use: {
|
30
|
+
loader: "esbuild-loader",
|
31
|
+
options: {
|
32
|
+
target: 'es2016'
|
33
|
+
},
|
34
|
+
},
|
35
|
+
}
|
36
|
+
|
37
|
+
const cssRules = {
|
38
|
+
test: /\.(s[ac]|c)ss$/,
|
39
|
+
use: [
|
40
|
+
MiniCssExtractPlugin.loader,
|
41
|
+
{
|
42
|
+
loader: "css-loader",
|
43
|
+
options: {
|
44
|
+
url: url => !url.startsWith('/'),
|
45
|
+
importLoaders: 1
|
46
|
+
}
|
47
|
+
}
|
48
|
+
],
|
49
|
+
mode: '<%= self.config.uses_postcss? ? "postcss" : "sass" %>',
|
50
|
+
|
51
|
+
postcss: () => {
|
52
|
+
cssRules.use.push("postcss-loader")
|
53
|
+
return { test: cssRules.test, use: cssRules.use }
|
54
|
+
},
|
55
|
+
|
56
|
+
sass: () => {
|
57
|
+
cssRules.use.push({
|
58
|
+
loader: "sass-loader",
|
59
|
+
options: {
|
60
|
+
implementation: require("sass"),
|
61
|
+
sassOptions: {
|
62
|
+
fiber: false,
|
63
|
+
includePaths: [
|
64
|
+
path.resolve(rootDir, "src/_components")
|
65
|
+
],
|
66
|
+
},
|
67
|
+
},
|
68
|
+
})
|
69
|
+
return { test: cssRules.test, use: cssRules.use }
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
const fontsRule = {
|
74
|
+
test: /\.woff2?$|\.ttf$|\.eot$/,
|
75
|
+
loader: "file-loader",
|
76
|
+
options: {
|
77
|
+
name: "[name]-[contenthash].[ext]",
|
78
|
+
outputPath: "../fonts",
|
79
|
+
publicPath: "../fonts",
|
80
|
+
},
|
81
|
+
}
|
82
|
+
|
83
|
+
const imagesRule = {
|
84
|
+
test: /\.png?$|\.gif$|\.jpg$|\.svg$/,
|
85
|
+
loader: "file-loader",
|
86
|
+
options: {
|
87
|
+
name: "[path][name]-[contenthash].[ext]",
|
88
|
+
outputPath: "../",
|
89
|
+
publicPath: "../",
|
19
90
|
},
|
91
|
+
}
|
92
|
+
|
93
|
+
// Default configuration object
|
94
|
+
|
95
|
+
module.exports = {
|
96
|
+
entry: entry,
|
20
97
|
devtool: "source-map",
|
21
98
|
// Set some or all of these to true if you want more verbose logging:
|
22
99
|
stats: {
|
@@ -25,10 +102,7 @@ module.exports = {
|
|
25
102
|
timings: false,
|
26
103
|
children: false,
|
27
104
|
},
|
28
|
-
output:
|
29
|
-
path: path.resolve(rootDir, "output", "_bridgetown", "static", "js"),
|
30
|
-
filename: "[name].[contenthash].js",
|
31
|
-
},
|
105
|
+
output: output,
|
32
106
|
resolve: {
|
33
107
|
extensions: [".js", ".jsx"],
|
34
108
|
modules: [
|
@@ -44,91 +118,13 @@ module.exports = {
|
|
44
118
|
new MiniCssExtractPlugin({
|
45
119
|
filename: "../css/[name].[contenthash].css",
|
46
120
|
}),
|
47
|
-
new
|
121
|
+
new WebpackManifestPlugin({
|
48
122
|
fileName: path.resolve(rootDir, ".bridgetown-webpack", "manifest.json"),
|
49
123
|
}),
|
50
124
|
],
|
51
125
|
module: {
|
52
126
|
rules: [
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
options: {
|
58
|
-
presets: ["@babel/preset-env"],
|
59
|
-
plugins: [
|
60
|
-
["@babel/plugin-proposal-decorators", { "legacy": true }],
|
61
|
-
["@babel/plugin-proposal-class-properties", { "loose" : true }],
|
62
|
-
[
|
63
|
-
"@babel/plugin-transform-runtime",
|
64
|
-
{
|
65
|
-
helpers: false,
|
66
|
-
},
|
67
|
-
],
|
68
|
-
["@babel/plugin-proposal-private-methods", { "loose": true }],
|
69
|
-
],
|
70
|
-
},
|
71
|
-
},
|
72
|
-
},
|
73
|
-
<% if self.config.uses_postcss? %>
|
74
|
-
{
|
75
|
-
test: /\.(s[ac]|c)ss$/,
|
76
|
-
use: [
|
77
|
-
MiniCssExtractPlugin.loader,
|
78
|
-
{
|
79
|
-
loader: "css-loader",
|
80
|
-
options: {
|
81
|
-
url: url => !url.startsWith('/'),
|
82
|
-
importLoaders: 1
|
83
|
-
}
|
84
|
-
},
|
85
|
-
"postcss-loader"
|
86
|
-
],
|
87
|
-
},
|
88
|
-
<% else %>
|
89
|
-
{
|
90
|
-
test: /\.(s[ac]|c)ss$/,
|
91
|
-
use: [
|
92
|
-
MiniCssExtractPlugin.loader,
|
93
|
-
{
|
94
|
-
loader: "css-loader",
|
95
|
-
options: {
|
96
|
-
url: url => !url.startsWith('/')
|
97
|
-
}
|
98
|
-
},
|
99
|
-
{
|
100
|
-
loader: "sass-loader",
|
101
|
-
options: {
|
102
|
-
implementation: require("sass"),
|
103
|
-
sassOptions: {
|
104
|
-
fiber: false,
|
105
|
-
includePaths: [
|
106
|
-
path.resolve(rootDir, "src/_components")
|
107
|
-
],
|
108
|
-
},
|
109
|
-
},
|
110
|
-
},
|
111
|
-
],
|
112
|
-
},
|
113
|
-
<% end %>
|
114
|
-
{
|
115
|
-
test: /\.woff2?$|\.ttf$|\.eot$/,
|
116
|
-
loader: "file-loader",
|
117
|
-
options: {
|
118
|
-
name: "[name]-[contenthash].[ext]",
|
119
|
-
outputPath: "../fonts",
|
120
|
-
publicPath: "../fonts",
|
121
|
-
},
|
122
|
-
},
|
123
|
-
{
|
124
|
-
test: /\.png?$|\.gif$|\.jpg$|\.svg$/,
|
125
|
-
loader: "file-loader",
|
126
|
-
options: {
|
127
|
-
name: "[path][name]-[contenthash].[ext]",
|
128
|
-
outputPath: "../",
|
129
|
-
publicPath: "../",
|
130
|
-
},
|
131
|
-
},
|
132
|
-
],
|
133
|
-
},
|
134
|
-
};
|
127
|
+
jsRule, cssRules[cssRules.mode](), fontsRule, imagesRule
|
128
|
+
]
|
129
|
+
}
|
130
|
+
}
|
@@ -24,7 +24,6 @@ class Bridgetown::Site
|
|
24
24
|
configure_include_paths
|
25
25
|
configure_file_read_opts
|
26
26
|
|
27
|
-
self.baseurl = config.baseurl
|
28
27
|
self.permalink_style = (config["permalink"] || "pretty").to_sym
|
29
28
|
|
30
29
|
@config
|
@@ -34,6 +33,22 @@ class Bridgetown::Site
|
|
34
33
|
config[:content_engine] == "resource"
|
35
34
|
end
|
36
35
|
|
36
|
+
# Returns a base path from which the site is served (aka `/cool-site`) or
|
37
|
+
# `/` if served from root.
|
38
|
+
#
|
39
|
+
# @param strip_slash_only [Boolean] set to true if you wish "/" to be returned as ""
|
40
|
+
# @return [String]
|
41
|
+
def base_path(strip_slash_only: false)
|
42
|
+
(config[:base_path] || config[:baseurl]).yield_self do |path|
|
43
|
+
strip_slash_only ? path.to_s.sub(%r{^/$}, "") : path
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def baseurl
|
48
|
+
Bridgetown::Deprecator.deprecation_message "Site#baseurl is now Site#base_path"
|
49
|
+
base_path(strip_slash_only: true).presence
|
50
|
+
end
|
51
|
+
|
37
52
|
def defaults_reader
|
38
53
|
@defaults_reader ||= Bridgetown::DefaultsReader.new(self)
|
39
54
|
end
|
@@ -54,7 +54,7 @@ module Bridgetown
|
|
54
54
|
"detach" => false, # default to not detaching the server
|
55
55
|
"port" => "4000",
|
56
56
|
"host" => "127.0.0.1",
|
57
|
-
"
|
57
|
+
"base_path" => "/",
|
58
58
|
"show_dir_listing" => false,
|
59
59
|
|
60
60
|
# Output Configuration
|
@@ -21,9 +21,14 @@ run "npx tailwindcss init"
|
|
21
21
|
|
22
22
|
copy_file "#{TEMPLATE_PATH}/postcss.config.js", "postcss.config.js", force: true
|
23
23
|
|
24
|
-
prepend_to_file "frontend/styles/index.css",
|
25
|
-
File.read("#{TEMPLATE_PATH}/css_imports.css")
|
26
|
-
|
27
24
|
run "bundle exec bridgetown configure purgecss"
|
28
25
|
|
26
|
+
if File.exist?("frontend/styles/index.css")
|
27
|
+
prepend_to_file "frontend/styles/index.css",
|
28
|
+
File.read("#{TEMPLATE_PATH}/css_imports.css")
|
29
|
+
else
|
30
|
+
say "\nPlease add the following lines to your CSS index file:"
|
31
|
+
say File.read("#{TEMPLATE_PATH}/css_imports.css")
|
32
|
+
end
|
33
|
+
|
29
34
|
# rubocop:enable all
|
@@ -17,6 +17,7 @@ module Bridgetown
|
|
17
17
|
:data,
|
18
18
|
:output,
|
19
19
|
:content,
|
20
|
+
:summary,
|
20
21
|
:to_s,
|
21
22
|
:absolute_url,
|
22
23
|
:relative_path,
|
@@ -48,7 +49,7 @@ module Bridgetown
|
|
48
49
|
end
|
49
50
|
|
50
51
|
def next
|
51
|
-
@next ||= @obj.
|
52
|
+
@next ||= @obj.next_resource.to_liquid
|
52
53
|
end
|
53
54
|
|
54
55
|
# Generate a Hash for use in generating JSON.
|
@@ -5,7 +5,7 @@ module Bridgetown
|
|
5
5
|
module URLFilters
|
6
6
|
extend self
|
7
7
|
|
8
|
-
# Produces an absolute URL based on site.url and site.
|
8
|
+
# Produces an absolute URL based on site.url and site.base_path.
|
9
9
|
#
|
10
10
|
# input - the URL to make absolute.
|
11
11
|
#
|
@@ -15,7 +15,7 @@ module Bridgetown
|
|
15
15
|
cache[input] ||= compute_absolute_url(input)
|
16
16
|
end
|
17
17
|
|
18
|
-
# Produces a URL relative to the domain root based on site.
|
18
|
+
# Produces a URL relative to the domain root based on site.base_path
|
19
19
|
# unless it is already an absolute url with an authority (host).
|
20
20
|
#
|
21
21
|
# input - the URL to make relative to the domain root
|
@@ -70,17 +70,13 @@ module Bridgetown
|
|
70
70
|
input = input.url if input.respond_to?(:url)
|
71
71
|
return input if Addressable::URI.parse(input.to_s).absolute?
|
72
72
|
|
73
|
-
|
73
|
+
site = @context.registers[:site]
|
74
|
+
parts = [site.base_path.chomp("/"), input]
|
74
75
|
Addressable::URI.parse(
|
75
76
|
parts.compact.map { |part| ensure_leading_slash(part.to_s) }.join
|
76
77
|
).normalize.to_s
|
77
78
|
end
|
78
79
|
|
79
|
-
def sanitized_baseurl
|
80
|
-
site = @context.registers[:site]
|
81
|
-
site.config["baseurl"].to_s.chomp("/")
|
82
|
-
end
|
83
|
-
|
84
80
|
def ensure_leading_slash(input)
|
85
81
|
return input if input.nil? || input.empty? || input.start_with?("/")
|
86
82
|
|
@@ -181,6 +181,16 @@ module Bridgetown
|
|
181
181
|
data["date"] ||= site.time
|
182
182
|
end
|
183
183
|
|
184
|
+
# Ask the configured summary extension to output a summary of the content,
|
185
|
+
# otherwise return the first line.
|
186
|
+
#
|
187
|
+
# @return [String]
|
188
|
+
def summary
|
189
|
+
return summary_extension_output if respond_to?(:summary_extension_output)
|
190
|
+
|
191
|
+
content.to_s.strip.lines.first.to_s.strip
|
192
|
+
end
|
193
|
+
|
184
194
|
# @return [Hash<String, Hash<String => Bridgetown::Resource::TaxonomyType,
|
185
195
|
# Array<Bridgetown::Resource::TaxonomyTerm>>>]
|
186
196
|
def taxonomies
|
@@ -32,7 +32,9 @@ module Bridgetown
|
|
32
32
|
|
33
33
|
def output_path
|
34
34
|
path = URL.unescape_path(relative_url)
|
35
|
-
|
35
|
+
if resource.site.base_path.present?
|
36
|
+
path = path.delete_prefix resource.site.base_path(strip_slash_only: true)
|
37
|
+
end
|
36
38
|
path = resource.site.in_dest_dir(path)
|
37
39
|
path = File.join(path, "index.html") if relative_url.end_with? "/"
|
38
40
|
path
|
@@ -40,7 +40,7 @@ module Bridgetown
|
|
40
40
|
# No relative URLs should ever end in /index.html
|
41
41
|
new_url.sub!(%r{/index$}, "") if final_ext == ".html"
|
42
42
|
|
43
|
-
|
43
|
+
add_base_path finalize_permalink(new_url, permalink)
|
44
44
|
end
|
45
45
|
|
46
46
|
def process_segment(segment)
|
@@ -96,8 +96,12 @@ module Bridgetown
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
-
def
|
100
|
-
resource.site.
|
99
|
+
def add_base_path(permalink)
|
100
|
+
if resource.site.base_path.present?
|
101
|
+
return "#{resource.site.base_path(strip_slash_only: true)}#{permalink}"
|
102
|
+
end
|
103
|
+
|
104
|
+
permalink
|
101
105
|
end
|
102
106
|
|
103
107
|
### Default Placeholders Processors
|
data/lib/bridgetown-core/site.rb
CHANGED
@@ -30,7 +30,7 @@ module Bridgetown
|
|
30
30
|
# is default
|
31
31
|
alias_method :generated_pages, :pages
|
32
32
|
|
33
|
-
attr_accessor :permalink_style, :time, :
|
33
|
+
attr_accessor :permalink_style, :time, :data,
|
34
34
|
:file_read_opts, :plugin_manager, :converters,
|
35
35
|
:generators, :reader
|
36
36
|
|
@@ -58,8 +58,9 @@ module Bridgetown
|
|
58
58
|
def destination(dest)
|
59
59
|
dest = site.in_dest_dir(dest)
|
60
60
|
dest_url = url
|
61
|
-
|
62
|
-
site.
|
61
|
+
if site.uses_resource? && site.base_path.present? && collection
|
62
|
+
dest_url = dest_url.delete_prefix site.base_path(strip_slash_only: true)
|
63
|
+
end
|
63
64
|
site.in_dest_dir(dest, Bridgetown::URL.unescape_path(dest_url))
|
64
65
|
end
|
65
66
|
|
@@ -15,9 +15,13 @@
|
|
15
15
|
# https://learnxinyminutes.com/docs/yaml/
|
16
16
|
#
|
17
17
|
|
18
|
-
baseurl: "" # OPTIONAL: the subpath of your site, e.g. /blog
|
19
18
|
url: "" # the base hostname & protocol for your site, e.g. https://example.com
|
20
19
|
|
21
20
|
permalink: pretty
|
22
21
|
|
22
|
+
# Other options you might want to investigate:
|
23
|
+
#
|
24
|
+
# base_path: "/" # the subpath of your site, e.g. /blog
|
23
25
|
# timezone: America/Los_Angeles
|
26
|
+
# pagination:
|
27
|
+
# enabled: true
|
@@ -13,15 +13,11 @@
|
|
13
13
|
"start": "node start.js"
|
14
14
|
},
|
15
15
|
"devDependencies": {
|
16
|
-
"@babel/core": "^7.9.0",
|
17
|
-
"@babel/plugin-proposal-class-properties": "^7.8.3",
|
18
|
-
"@babel/plugin-proposal-decorators": "^7.10.1",
|
19
|
-
"@babel/plugin-transform-runtime": "^7.9.0",
|
20
|
-
"@babel/preset-env": "^7.9.0",
|
21
|
-
"babel-loader": "^8.1.0",
|
22
16
|
"browser-sync": "^2.26.7",
|
23
17
|
"concurrently": "^5.2.0",
|
24
18
|
"css-loader": "^4.3.0",
|
19
|
+
"esbuild": "^0.12.7",
|
20
|
+
"esbuild-loader": "^2.13.1",
|
25
21
|
"file-loader": "^6.2.0",
|
26
22
|
"mini-css-extract-plugin": "^1.3.1",
|
27
23
|
<% if options["use-postcss"] %>
|
@@ -33,8 +29,9 @@
|
|
33
29
|
"sass": "^1.32.8",
|
34
30
|
"sass-loader": "^8.0.2",
|
35
31
|
<% end %>
|
36
|
-
"webpack": "^
|
37
|
-
"webpack-cli": "^
|
38
|
-
"webpack-manifest-plugin": "^
|
32
|
+
"webpack": "^5.39.1",
|
33
|
+
"webpack-cli": "^4.7.2",
|
34
|
+
"webpack-manifest-plugin": "^3.1.1"
|
35
|
+
"webpack-merge": "^5.8.0"
|
39
36
|
}
|
40
37
|
}
|
@@ -7,5 +7,5 @@
|
|
7
7
|
title: Your awesome title
|
8
8
|
tagline: This site is totally awesome
|
9
9
|
email: your-email@example.com
|
10
|
-
description: >-
|
10
|
+
description: >-
|
11
11
|
Write an awesome description for your new site here. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
|
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: 0.21.
|
4
|
+
version: 0.21.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: 2021-
|
11
|
+
date: 2021-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|