jekyll-webpack 0.2.1 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +35 -35
- data/README.md +55 -7
- data/lib/jekyll/webpack.rb +35 -0
- data/lib/jekyll/webpack/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 607c1063222b8746e6e1a90de9a5272e41895beba7672c72e8b9742823593412
|
4
|
+
data.tar.gz: e141cb8fcb480ef152b731554ba4fef8cee98bf8b4263f4f7d0a4ccc06630cfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf664c9e5c38e781ab700c92aa725ed93b74dd62d7fa5fcf94cfb2211e9b8595bfe19d4dd1ff4252d13bd1310dd0dd8711db9cf006c5ba6939944aae89c12fd9
|
7
|
+
data.tar.gz: 04fc1d4d20fa4ed5290a596658e56a70e2873cbd6f8f0abf2740ff964960b547c2803aeea277139cbfd945843b312442e20fa47f20df8460293b055255802fd7
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,32 +1,32 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
jekyll-webpack (0.2.
|
4
|
+
jekyll-webpack (0.2.3)
|
5
5
|
jekyll
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
addressable (2.
|
10
|
+
addressable (2.8.0)
|
11
11
|
public_suffix (>= 2.0.2, < 5.0)
|
12
12
|
coderay (1.1.3)
|
13
13
|
colorator (1.1.0)
|
14
|
-
concurrent-ruby (1.1.
|
15
|
-
diff-lcs (1.
|
16
|
-
em-websocket (0.5.
|
14
|
+
concurrent-ruby (1.1.9)
|
15
|
+
diff-lcs (1.4.4)
|
16
|
+
em-websocket (0.5.2)
|
17
17
|
eventmachine (>= 0.12.9)
|
18
18
|
http_parser.rb (~> 0.6.0)
|
19
19
|
eventmachine (1.2.7)
|
20
|
-
ffi (1.
|
21
|
-
formatador (0.
|
20
|
+
ffi (1.15.3)
|
21
|
+
formatador (0.3.0)
|
22
22
|
forwardable-extended (2.6.0)
|
23
|
-
guard (2.
|
23
|
+
guard (2.18.0)
|
24
24
|
formatador (>= 0.2.4)
|
25
25
|
listen (>= 2.7, < 4.0)
|
26
26
|
lumberjack (>= 1.0.12, < 2.0)
|
27
27
|
nenv (~> 0.1)
|
28
28
|
notiffany (~> 0.0)
|
29
|
-
pry (>= 0.
|
29
|
+
pry (>= 0.13.0)
|
30
30
|
shellany (~> 0.0)
|
31
31
|
thor (>= 0.18.1)
|
32
32
|
guard-compat (1.2.1)
|
@@ -35,36 +35,36 @@ GEM
|
|
35
35
|
guard-compat (~> 1.1)
|
36
36
|
rspec (>= 2.99.0, < 4.0)
|
37
37
|
http_parser.rb (0.6.0)
|
38
|
-
i18n (1.8.
|
38
|
+
i18n (1.8.10)
|
39
39
|
concurrent-ruby (~> 1.0)
|
40
|
-
jekyll (4.
|
40
|
+
jekyll (4.2.0)
|
41
41
|
addressable (~> 2.4)
|
42
42
|
colorator (~> 1.0)
|
43
43
|
em-websocket (~> 0.5)
|
44
44
|
i18n (~> 1.0)
|
45
45
|
jekyll-sass-converter (~> 2.0)
|
46
46
|
jekyll-watch (~> 2.0)
|
47
|
-
kramdown (~> 2.
|
47
|
+
kramdown (~> 2.3)
|
48
48
|
kramdown-parser-gfm (~> 1.0)
|
49
49
|
liquid (~> 4.0)
|
50
50
|
mercenary (~> 0.4.0)
|
51
51
|
pathutil (~> 0.9)
|
52
52
|
rouge (~> 3.0)
|
53
53
|
safe_yaml (~> 1.0)
|
54
|
-
terminal-table (~>
|
54
|
+
terminal-table (~> 2.0)
|
55
55
|
jekyll-sass-converter (2.1.0)
|
56
56
|
sassc (> 2.0.1, < 3.0)
|
57
57
|
jekyll-watch (2.2.1)
|
58
58
|
listen (~> 3.0)
|
59
|
-
kramdown (2.
|
59
|
+
kramdown (2.3.1)
|
60
60
|
rexml
|
61
61
|
kramdown-parser-gfm (1.1.0)
|
62
62
|
kramdown (~> 2.0)
|
63
63
|
liquid (4.0.3)
|
64
|
-
listen (3.
|
64
|
+
listen (3.5.1)
|
65
65
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
66
66
|
rb-inotify (~> 0.9, >= 0.9.10)
|
67
|
-
lumberjack (1.2.
|
67
|
+
lumberjack (1.2.8)
|
68
68
|
mercenary (0.4.0)
|
69
69
|
method_source (1.0.0)
|
70
70
|
nenv (0.3.0)
|
@@ -73,36 +73,36 @@ GEM
|
|
73
73
|
shellany (~> 0.0)
|
74
74
|
pathutil (0.16.2)
|
75
75
|
forwardable-extended (~> 2.6)
|
76
|
-
pry (0.
|
76
|
+
pry (0.14.1)
|
77
77
|
coderay (~> 1.1)
|
78
78
|
method_source (~> 1.0)
|
79
|
-
public_suffix (4.0.
|
79
|
+
public_suffix (4.0.6)
|
80
80
|
rake (12.3.3)
|
81
|
-
rb-fsevent (0.
|
81
|
+
rb-fsevent (0.11.0)
|
82
82
|
rb-inotify (0.10.1)
|
83
83
|
ffi (~> 1.0)
|
84
|
-
rexml (3.2.
|
85
|
-
rouge (3.
|
86
|
-
rspec (3.
|
87
|
-
rspec-core (~> 3.
|
88
|
-
rspec-expectations (~> 3.
|
89
|
-
rspec-mocks (~> 3.
|
90
|
-
rspec-core (3.
|
91
|
-
rspec-support (~> 3.
|
92
|
-
rspec-expectations (3.
|
84
|
+
rexml (3.2.5)
|
85
|
+
rouge (3.26.0)
|
86
|
+
rspec (3.10.0)
|
87
|
+
rspec-core (~> 3.10.0)
|
88
|
+
rspec-expectations (~> 3.10.0)
|
89
|
+
rspec-mocks (~> 3.10.0)
|
90
|
+
rspec-core (3.10.1)
|
91
|
+
rspec-support (~> 3.10.0)
|
92
|
+
rspec-expectations (3.10.1)
|
93
93
|
diff-lcs (>= 1.2.0, < 2.0)
|
94
|
-
rspec-support (~> 3.
|
95
|
-
rspec-mocks (3.
|
94
|
+
rspec-support (~> 3.10.0)
|
95
|
+
rspec-mocks (3.10.2)
|
96
96
|
diff-lcs (>= 1.2.0, < 2.0)
|
97
|
-
rspec-support (~> 3.
|
98
|
-
rspec-support (3.
|
97
|
+
rspec-support (~> 3.10.0)
|
98
|
+
rspec-support (3.10.2)
|
99
99
|
safe_yaml (1.0.5)
|
100
100
|
sassc (2.4.0)
|
101
101
|
ffi (~> 1.9)
|
102
102
|
shellany (0.0.1)
|
103
|
-
terminal-table (
|
103
|
+
terminal-table (2.0.0)
|
104
104
|
unicode-display_width (~> 1.1, >= 1.1.1)
|
105
|
-
thor (1.0
|
105
|
+
thor (1.1.0)
|
106
106
|
unicode-display_width (1.7.0)
|
107
107
|
|
108
108
|
PLATFORMS
|
@@ -118,4 +118,4 @@ DEPENDENCIES
|
|
118
118
|
rspec (~> 3.0)
|
119
119
|
|
120
120
|
BUNDLED WITH
|
121
|
-
2.
|
121
|
+
2.2.3
|
data/README.md
CHANGED
@@ -6,8 +6,6 @@ This plugin will allow you to build your assets with Webpack _after_ Jekyll has
|
|
6
6
|
|
7
7
|
This adds Webpack at a sane point in the build pipeline and will also allow you to parameterize your webpack and other JS config files by prepending them with front matter, before the compilation occurs. You can see a functioning example in the `spec/fixtures` folder:-
|
8
8
|
|
9
|
-
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.
|
10
|
-
|
11
9
|
|
12
10
|
## Installation
|
13
11
|
|
@@ -32,13 +30,16 @@ plugins:
|
|
32
30
|
- jekyll/webpack
|
33
31
|
```
|
34
32
|
|
35
|
-
|
36
|
-
|
37
|
-
`yarn add webpack webpack-cli --dev`
|
33
|
+
NOTE the `/` - the `-` variant is not available yet.
|
38
34
|
|
39
|
-
|
35
|
+
ALSO NOTE - it's probably advisable to place this plugin as the very last one in the build pipe. EG:-
|
40
36
|
|
41
|
-
|
37
|
+
```yml
|
38
|
+
plugins:
|
39
|
+
- jekyll-otherplug
|
40
|
+
...
|
41
|
+
- jekyll/webpack
|
42
|
+
```
|
42
43
|
|
43
44
|
## Usage
|
44
45
|
|
@@ -46,6 +47,53 @@ In your root Jekyll project folder you need to have Webpack installed, so:-
|
|
46
47
|
|
47
48
|
`yarn add webpack webpack-cli --dev`
|
48
49
|
|
50
|
+
And the basic JS entrypoint `mkdir src && touch src/index.js`
|
51
|
+
|
52
|
+
And you're away! Just run the `jekyll serve` or `jekyll build` commands with whatever env you need.
|
53
|
+
|
54
|
+
## Config
|
55
|
+
|
56
|
+
### Configuring JS config files
|
57
|
+
|
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.
|
59
|
+
|
60
|
+
### Cleanup
|
61
|
+
If you wish to clean out unused source files after webpack has run that got included in the compiled site, you need to add an entry into your `_config.yml` like:
|
62
|
+
|
63
|
+
``` yml
|
64
|
+
// _config.yml
|
65
|
+
|
66
|
+
webpack:
|
67
|
+
cleanup_files: src
|
68
|
+
|
69
|
+
// or an array
|
70
|
+
|
71
|
+
webpack:
|
72
|
+
cleanup_files:
|
73
|
+
- src
|
74
|
+
- node_modules
|
75
|
+
```
|
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
|
+
|
96
|
+
|
49
97
|
## Development
|
50
98
|
|
51
99
|
After checking out the repo, run `bin/setup` to install dependencies. Then `cd spec/fixtures && yarn` to install required JS dependencies for specs. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
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)
|
@@ -20,6 +27,34 @@ module Jekyll
|
|
20
27
|
|
21
28
|
raise Error, stderr if stderr.size > 0
|
22
29
|
raise Error, stdout if !runtime_error.nil?
|
30
|
+
|
31
|
+
cleanup(site)
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.cleanup(site)
|
35
|
+
cleanup_files = site.config.dig('webpack', 'cleanup_files')
|
36
|
+
|
37
|
+
if cleanup_files
|
38
|
+
array_or_scalar(cleanup_files) do |dest_for_clean|
|
39
|
+
path = File.expand_path(dest_for_clean, site.dest)
|
40
|
+
|
41
|
+
if File.exists?(path) || Dir.exists?(path)
|
42
|
+
FileUtils.rm_rf(path)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def self.array_or_scalar(value)
|
51
|
+
if Array === value
|
52
|
+
value.each do |entry|
|
53
|
+
yield entry
|
54
|
+
end
|
55
|
+
else
|
56
|
+
yield value
|
57
|
+
end
|
23
58
|
end
|
24
59
|
end
|
25
60
|
end
|
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Martin
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -137,7 +137,7 @@ licenses:
|
|
137
137
|
metadata:
|
138
138
|
homepage_uri: https://github.com/tevio/jekyll-webpack
|
139
139
|
source_code_uri: https://github.com/mml/jekyll-webpack
|
140
|
-
post_install_message:
|
140
|
+
post_install_message:
|
141
141
|
rdoc_options: []
|
142
142
|
require_paths:
|
143
143
|
- lib
|
@@ -152,8 +152,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: '0'
|
154
154
|
requirements: []
|
155
|
-
rubygems_version: 3.
|
156
|
-
signing_key:
|
155
|
+
rubygems_version: 3.2.3
|
156
|
+
signing_key:
|
157
157
|
specification_version: 4
|
158
158
|
summary: Compile assets with webpack
|
159
159
|
test_files: []
|