jekyll-webpack 0.2.2 → 0.2.3
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 +1 -1
- data/README.md +22 -2
- data/lib/jekyll/webpack.rb +20 -0
- 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: 31abce3cd4da824c622c173ac49a6333cf158582282df0b3a58478961b735ce3
|
4
|
+
data.tar.gz: c0e035e43cf07196a7c77c22be48412d221d2764c4da1495f51bc9e58b1d4885
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56f2dcf610774180929422a5fce57a143c305cd915b39f2d07d75adbc2e3db2e75798bb6ff2c62dd059d450713af3b75b83334eb4c962d8f074745797443d7cb
|
7
|
+
data.tar.gz: 8e98b26fffdda171b61001e5f2ffb11bbb102fd3d796b96cde3d20d360c6ca67391f7e376a956783d042dcadc10166c22e8acaaa28bdfc462ed3191e99847036
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
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
|
|
@@ -53,6 +51,28 @@ And the basic JS entrypoint `mkdir src && touch src/index.js`
|
|
53
51
|
|
54
52
|
And you're away! Just run the `jekyll serve` or `jekyll build` commands with whatever env you need.
|
55
53
|
|
54
|
+
### Configuring JS config files
|
55
|
+
|
56
|
+
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.
|
57
|
+
|
58
|
+
### Cleanup
|
59
|
+
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:
|
60
|
+
|
61
|
+
``` yml
|
62
|
+
// _config.yml
|
63
|
+
|
64
|
+
webpack:
|
65
|
+
cleanup_files: src
|
66
|
+
|
67
|
+
// or an array
|
68
|
+
|
69
|
+
webpack:
|
70
|
+
cleanup_files:
|
71
|
+
- src
|
72
|
+
- node_modules
|
73
|
+
```
|
74
|
+
|
75
|
+
|
56
76
|
## Development
|
57
77
|
|
58
78
|
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
@@ -20,6 +20,26 @@ module Jekyll
|
|
20
20
|
|
21
21
|
raise Error, stderr if stderr.size > 0
|
22
22
|
raise Error, stdout if !runtime_error.nil?
|
23
|
+
|
24
|
+
cleanup(site)
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.cleanup(site)
|
28
|
+
cleanup_files = site.config.dig('webpack', 'cleanup_files')
|
29
|
+
|
30
|
+
if cleanup_files
|
31
|
+
if Array === cleanup_files
|
32
|
+
cleanup_files.each do |dest_for_clean|
|
33
|
+
if Dir.exists?(File.expand_path(dest_for_clean, site.dest))
|
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))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
23
43
|
end
|
24
44
|
end
|
25
45
|
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.3
|
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-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|