bridgetown-core 0.10.0 → 0.10.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/tags/webpack_path.rb +42 -0
- data/lib/bridgetown-core/version.rb +1 -1
- data/lib/bridgetown-core/watcher.rb +4 -1
- data/lib/site_template/.gitignore +1 -0
- data/lib/site_template/package.json +2 -1
- data/lib/site_template/src/_includes/head.html +2 -2
- data/lib/site_template/webpack.config.js +28 -17
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31902453cc98a9dd7477a25c07f005b5f4faecbd69bf45e166d13c7ff9406c79
|
4
|
+
data.tar.gz: 5d9d919d9f2d13c0a6f572d166057c437e1e996ea7f5658972fc31f5e7cb539c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54a5ad80eccbc1702bd5743afa6eb78cb3e5c5615495acbe7fe178c55447ef3ae45bdd7be8aae6e89278258f8c2cbc86ec6a826f79a15a41b38b7c2ad498d815
|
7
|
+
data.tar.gz: b6504df792cb0804cfb0a0feba76c90da44e63a38d325d40f5b543cb616ba06b5ce26ea957b883404d65bfbbefeb539e1170654d00cc4ff9144e25e260acd931
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bridgetown
|
4
|
+
module Tags
|
5
|
+
class WebpackPath < Liquid::Tag
|
6
|
+
include Bridgetown::Filters::URLFilters
|
7
|
+
|
8
|
+
def initialize(tag_name, asset_type, tokens)
|
9
|
+
super
|
10
|
+
|
11
|
+
# js or css
|
12
|
+
@asset_type = asset_type.strip
|
13
|
+
end
|
14
|
+
|
15
|
+
def render(context)
|
16
|
+
@context = context
|
17
|
+
site = context.registers[:site]
|
18
|
+
|
19
|
+
frontend_path = relative_url("_bridgetown/static")
|
20
|
+
|
21
|
+
manifest_file = site.in_root_dir(".bridgetown-webpack", "manifest.json")
|
22
|
+
if File.exist?(manifest_file)
|
23
|
+
manifest = JSON.parse(File.read(manifest_file))
|
24
|
+
if @asset_type == "js"
|
25
|
+
js_path = manifest["main.js"].split("/").last
|
26
|
+
[frontend_path, "js", js_path].join("/")
|
27
|
+
elsif @asset_type == "css"
|
28
|
+
css_path = manifest["main.css"].split("/").last
|
29
|
+
[frontend_path, "css", css_path].join("/")
|
30
|
+
else
|
31
|
+
Bridgetown.logger.error("Unknown Webpack asset type", @asset_type)
|
32
|
+
nil
|
33
|
+
end
|
34
|
+
else
|
35
|
+
"MISSING_WEBPACK_MANIFEST"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
Liquid::Template.register_tag("webpack_path", Bridgetown::Tags::WebpackPath)
|
@@ -37,8 +37,11 @@ module Bridgetown
|
|
37
37
|
private
|
38
38
|
|
39
39
|
def build_listener(site, options)
|
40
|
+
webpack_path = site.in_root_dir(".bridgetown-webpack")
|
41
|
+
FileUtils.mkdir(webpack_path) unless Dir.exist?(webpack_path)
|
40
42
|
Listen.to(
|
41
43
|
options["source"],
|
44
|
+
site.in_root_dir(".bridgetown-webpack"),
|
42
45
|
ignore: listen_ignore_paths(options),
|
43
46
|
force_polling: options["force_polling"],
|
44
47
|
&listen_handler(site)
|
@@ -54,7 +57,7 @@ module Bridgetown
|
|
54
57
|
Bridgetown.logger.info "Regenerating…"
|
55
58
|
Bridgetown.logger.info "", "#{n} file(s) changed at #{t.strftime("%Y-%m-%d %H:%M:%S")}"
|
56
59
|
|
57
|
-
c.each { |path| Bridgetown.logger.info "", path["#{site.
|
60
|
+
c.each { |path| Bridgetown.logger.info "", path["#{site.root_dir}/".length..-1] }
|
58
61
|
process(site, t)
|
59
62
|
end
|
60
63
|
end
|
@@ -5,5 +5,5 @@
|
|
5
5
|
|
6
6
|
<meta name="description" content="{{ site.metadata.description }}" />
|
7
7
|
|
8
|
-
<link rel="stylesheet" href="
|
9
|
-
<script src="
|
8
|
+
<link rel="stylesheet" href="{% webpack_path css %}" />
|
9
|
+
<script src="{% webpack_path js %}" defer></script>
|
@@ -1,19 +1,30 @@
|
|
1
|
-
const path = require(
|
2
|
-
const MiniCssExtractPlugin = require("mini-css-extract-plugin")
|
1
|
+
const path = require("path")
|
2
|
+
const MiniCssExtractPlugin = require("mini-css-extract-plugin")
|
3
|
+
const ManifestPlugin = require("webpack-manifest-plugin")
|
3
4
|
|
4
5
|
module.exports = {
|
5
|
-
entry:
|
6
|
+
entry: "./frontend/javascript/index.js",
|
6
7
|
devtool: "source-map",
|
8
|
+
// Set some or all of these to true if you want more verbose logging:
|
9
|
+
stats: {
|
10
|
+
modules: false,
|
11
|
+
builtAt: false,
|
12
|
+
timings: false,
|
13
|
+
children: false
|
14
|
+
},
|
7
15
|
output: {
|
8
|
-
path: path.resolve(__dirname,
|
9
|
-
filename:
|
16
|
+
path: path.resolve(__dirname, "output", "_bridgetown", "static", "js"),
|
17
|
+
filename: "all.[contenthash].js"
|
10
18
|
},
|
11
19
|
resolve: {
|
12
|
-
extensions: [
|
20
|
+
extensions: [".js"]
|
13
21
|
},
|
14
22
|
plugins: [
|
15
23
|
new MiniCssExtractPlugin({
|
16
|
-
filename: "../css/all.css",
|
24
|
+
filename: "../css/all.[contenthash].css",
|
25
|
+
}),
|
26
|
+
new ManifestPlugin({
|
27
|
+
fileName: path.resolve(__dirname, ".bridgetown-webpack", "manifest.json")
|
17
28
|
})
|
18
29
|
],
|
19
30
|
module: {
|
@@ -21,13 +32,13 @@ module.exports = {
|
|
21
32
|
{
|
22
33
|
test: /\.js/,
|
23
34
|
use: {
|
24
|
-
loader:
|
35
|
+
loader: "babel-loader",
|
25
36
|
options: {
|
26
37
|
presets: [
|
27
|
-
|
38
|
+
"@babel/preset-env"
|
28
39
|
],
|
29
40
|
plugins: [
|
30
|
-
|
41
|
+
"@babel/plugin-proposal-class-properties"
|
31
42
|
]
|
32
43
|
}
|
33
44
|
}
|
@@ -36,12 +47,12 @@ module.exports = {
|
|
36
47
|
test: /\.(sc|c)ss$/,
|
37
48
|
use: [
|
38
49
|
MiniCssExtractPlugin.loader,
|
39
|
-
|
50
|
+
"css-loader",
|
40
51
|
{
|
41
|
-
loader:
|
52
|
+
loader: "sass-loader",
|
42
53
|
options: {
|
43
54
|
sassOptions: {
|
44
|
-
includePaths: [path.resolve(__dirname,
|
55
|
+
includePaths: [path.resolve(__dirname, "src/_includes")]
|
45
56
|
}
|
46
57
|
}
|
47
58
|
}
|
@@ -49,12 +60,12 @@ module.exports = {
|
|
49
60
|
},
|
50
61
|
{
|
51
62
|
test: /\.woff2?$|\.ttf$|\.eot$|\.svg$/,
|
52
|
-
loader:
|
63
|
+
loader: "file-loader",
|
53
64
|
options: {
|
54
|
-
outputPath:
|
55
|
-
publicPath:
|
65
|
+
outputPath: "../fonts",
|
66
|
+
publicPath: "../fonts"
|
56
67
|
},
|
57
68
|
}
|
58
69
|
]
|
59
70
|
}
|
60
|
-
}
|
71
|
+
}
|
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.10.
|
4
|
+
version: 0.10.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: 2020-04-
|
11
|
+
date: 2020-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -264,6 +264,7 @@ files:
|
|
264
264
|
- lib/bridgetown-core/tags/link.rb
|
265
265
|
- lib/bridgetown-core/tags/post_url.rb
|
266
266
|
- lib/bridgetown-core/tags/render_content.rb
|
267
|
+
- lib/bridgetown-core/tags/webpack_path.rb
|
267
268
|
- lib/bridgetown-core/url.rb
|
268
269
|
- lib/bridgetown-core/utils.rb
|
269
270
|
- lib/bridgetown-core/utils/ansi.rb
|