jekyll-webpack 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -0
- data/lib/jekyll/webpack.rb +22 -9
- data/lib/jekyll/webpack/version.rb +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: 33dede3fdb6014a97d8f77a9db5dd151ca0c9ba9a11c7a3fc9a5bcb3c24b150d
|
4
|
+
data.tar.gz: 6c523b04a532a1edb0565e2ec31b1e70f37c6fbf4349b3e19d13c22c77e873ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d291a385e04da5a17b60b783e8c4e617d38cbcb36a9b4985600cc32cb54fface89764e06623e0b5d2a66c6fec6df7a7719d8f499e3817fc0b937f8efbcad667f
|
7
|
+
data.tar.gz: 0f587a0f0b3ca7439b978a20f57f395620435739f7b594374416d5c6abe926a03837a6efdb8fe1b541cbf9363e150184ba748a86ca7479ece1e2fcd9cac83d04
|
data/README.md
CHANGED
@@ -51,6 +51,8 @@ And the basic JS entrypoint `mkdir src && touch src/index.js`
|
|
51
51
|
|
52
52
|
And you're away! Just run the `jekyll serve` or `jekyll build` commands with whatever env you need.
|
53
53
|
|
54
|
+
## Config
|
55
|
+
|
54
56
|
### Configuring JS config files
|
55
57
|
|
56
58
|
There is a `_data/tailwind.yml` file in the fixure site that's picked up by adding a frontmatter declaration in `tailwind.config.js`. This Tailwind config is in turn picked up by the outputted webpack config and parsed when webpack runs.
|
@@ -72,6 +74,25 @@ webpack:
|
|
72
74
|
- node_modules
|
73
75
|
```
|
74
76
|
|
77
|
+
### Dest inclusion (excluding
|
78
|
+
If want to ensure that webpack only runs in a specific site dest (eg `_site` only, and no subdirectories) you can pass a single path value or an inclusion list of paths you want webpack to run in, at config time, by modifiying the `_config.yml` like so:
|
79
|
+
|
80
|
+
``` yml
|
81
|
+
// _config.yml
|
82
|
+
|
83
|
+
webpack:
|
84
|
+
only_in: _site
|
85
|
+
|
86
|
+
// or as a list
|
87
|
+
webpack:
|
88
|
+
only_in:
|
89
|
+
- _site
|
90
|
+
- _build
|
91
|
+
```
|
92
|
+
|
93
|
+
### Example `_config.yml`
|
94
|
+
You can have a look at the possible configuration options in the fixtures config file at `spec/fixtures/_config.yml` in this repo.
|
95
|
+
|
75
96
|
|
76
97
|
## Development
|
77
98
|
|
data/lib/jekyll/webpack.rb
CHANGED
@@ -11,6 +11,13 @@ module Jekyll
|
|
11
11
|
def self.build(site)
|
12
12
|
site_dest = site.dest
|
13
13
|
|
14
|
+
only_in = site.config.dig('webpack', 'only_in')
|
15
|
+
if only_in
|
16
|
+
entries = []
|
17
|
+
array_or_scalar(only_in) { |entry| entries << site_dest.end_with?(entry) }
|
18
|
+
return unless entries.any? true
|
19
|
+
end
|
20
|
+
|
14
21
|
stdout, stderr, status = Open3.capture3(
|
15
22
|
"../node_modules/.bin/webpack",
|
16
23
|
chdir: File.expand_path(site_dest)
|
@@ -28,19 +35,25 @@ module Jekyll
|
|
28
35
|
cleanup_files = site.config.dig('webpack', 'cleanup_files')
|
29
36
|
|
30
37
|
if cleanup_files
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
FileUtils.rm_rf(File.expand_path(dest_for_clean, site.dest))
|
35
|
-
end
|
36
|
-
end
|
37
|
-
else
|
38
|
-
if Dir.exists?(File.expand_path(cleanup_files, site.dest))
|
39
|
-
FileUtils.rm_rf(File.expand_path(dest_src_for_clean, site.dest))
|
38
|
+
array_or_scalar(cleanup_files) do |dest_for_clean|
|
39
|
+
if Dir.exists?(File.expand_path(dest_for_clean, site.dest))
|
40
|
+
FileUtils.rm_rf(File.expand_path(dest_for_clean, site.dest))
|
40
41
|
end
|
41
42
|
end
|
42
43
|
end
|
43
44
|
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def self.array_or_scalar(value)
|
49
|
+
if Array === value
|
50
|
+
value.each do |entry|
|
51
|
+
yield entry
|
52
|
+
end
|
53
|
+
else
|
54
|
+
yield value
|
55
|
+
end
|
56
|
+
end
|
44
57
|
end
|
45
58
|
end
|
46
59
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-webpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Martin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|