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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e9f0f3c149684bc8a7991b989f33faa3b15be2644fdd797971a4a5b55b41d92
4
- data.tar.gz: 80e1a6d14f26db3304c2988ef60f2b8015fb9bc8900221ad2336b6bb4ce92dd7
3
+ metadata.gz: 31abce3cd4da824c622c173ac49a6333cf158582282df0b3a58478961b735ce3
4
+ data.tar.gz: c0e035e43cf07196a7c77c22be48412d221d2764c4da1495f51bc9e58b1d4885
5
5
  SHA512:
6
- metadata.gz: d0d1db97c34caa606f07971bf43253a836010c4c46602efc8b126bc781771f42dc86f1524014f34564e72897e895539a29a53c5857d3455f2adb1d3aa4f75283
7
- data.tar.gz: 816ee670a833a53097bc893950c9d56c4d022e1769dce9cede555f75eee35da844ec70d7ca8dcaabe1f1b09a84e06805f5a7e191c3f215c71fb935befdf4a336
6
+ metadata.gz: 56f2dcf610774180929422a5fce57a143c305cd915b39f2d07d75adbc2e3db2e75798bb6ff2c62dd059d450713af3b75b83334eb4c962d8f074745797443d7cb
7
+ data.tar.gz: 8e98b26fffdda171b61001e5f2ffb11bbb102fd3d796b96cde3d20d360c6ca67391f7e376a956783d042dcadc10166c22e8acaaa28bdfc462ed3191e99847036
data/.gitignore CHANGED
@@ -8,6 +8,7 @@
8
8
  /tmp/
9
9
  /spec/fixtures/.jekyll-cache/
10
10
  /spec/fixtures/_site/
11
+ /spec/fixtures/dist/
11
12
  /spec/fixtures/node_modules/
12
13
  /*.gem
13
14
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jekyll-webpack (0.2.1)
4
+ jekyll-webpack (0.2.3)
5
5
  jekyll
6
6
 
7
7
  GEM
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.
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Webpack
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
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.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-20 00:00:00.000000000 Z
11
+ date: 2021-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll