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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31abce3cd4da824c622c173ac49a6333cf158582282df0b3a58478961b735ce3
4
- data.tar.gz: c0e035e43cf07196a7c77c22be48412d221d2764c4da1495f51bc9e58b1d4885
3
+ metadata.gz: 33dede3fdb6014a97d8f77a9db5dd151ca0c9ba9a11c7a3fc9a5bcb3c24b150d
4
+ data.tar.gz: 6c523b04a532a1edb0565e2ec31b1e70f37c6fbf4349b3e19d13c22c77e873ee
5
5
  SHA512:
6
- metadata.gz: 56f2dcf610774180929422a5fce57a143c305cd915b39f2d07d75adbc2e3db2e75798bb6ff2c62dd059d450713af3b75b83334eb4c962d8f074745797443d7cb
7
- data.tar.gz: 8e98b26fffdda171b61001e5f2ffb11bbb102fd3d796b96cde3d20d360c6ca67391f7e376a956783d042dcadc10166c22e8acaaa28bdfc462ed3191e99847036
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
 
@@ -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
- 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))
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
 
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Webpack
3
- VERSION = "0.2.3"
3
+ VERSION = "0.2.4"
4
4
  end
5
5
  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.3
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-25 00:00:00.000000000 Z
11
+ date: 2021-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll