jekyll-webpack 0.1.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: e9e56e62d305675a60644d8cd096a91b0b1738dd4acf7d1782a79944d3a1eea5
4
- data.tar.gz: dab9f105e280cb11b48e0d2632c0e648757ef9a7236ea35224647484951412a0
3
+ metadata.gz: 31abce3cd4da824c622c173ac49a6333cf158582282df0b3a58478961b735ce3
4
+ data.tar.gz: c0e035e43cf07196a7c77c22be48412d221d2764c4da1495f51bc9e58b1d4885
5
5
  SHA512:
6
- metadata.gz: 57f621cf3eb1ba13eacd520da1b4f70ea0a312afa60a96ee75552beb724bb970bbef7b3f40ec3c234596f55148dfe3095fd77a0de1b0e0da509c9a80179d72f8
7
- data.tar.gz: 12f7e08a0a3c7a0f0e610a69e5c5b060bd2de8983b75467db8c5cc8b09f1696a24a56ee5e16512cfe41363febd87d4f929b3471e474ba42172bd50bb852358d9
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,32 +1,32 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jekyll-webpack (0.1.1)
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.7.0)
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.6)
15
- diff-lcs (1.3)
16
- em-websocket (0.5.1)
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.13.0)
21
- formatador (0.2.5)
20
+ ffi (1.15.3)
21
+ formatador (0.3.0)
22
22
  forwardable-extended (2.6.0)
23
- guard (2.16.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.9.12)
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.3)
38
+ i18n (1.8.10)
39
39
  concurrent-ruby (~> 1.0)
40
- jekyll (4.1.0)
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.1)
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 (~> 1.8)
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.2.1)
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.2.1)
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.5)
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.13.1)
76
+ pry (0.14.1)
77
77
  coderay (~> 1.1)
78
78
  method_source (~> 1.0)
79
- public_suffix (4.0.5)
79
+ public_suffix (4.0.6)
80
80
  rake (12.3.3)
81
- rb-fsevent (0.10.4)
81
+ rb-fsevent (0.11.0)
82
82
  rb-inotify (0.10.1)
83
83
  ffi (~> 1.0)
84
- rexml (3.2.4)
85
- rouge (3.19.0)
86
- rspec (3.9.0)
87
- rspec-core (~> 3.9.0)
88
- rspec-expectations (~> 3.9.0)
89
- rspec-mocks (~> 3.9.0)
90
- rspec-core (3.9.2)
91
- rspec-support (~> 3.9.3)
92
- rspec-expectations (3.9.2)
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.9.0)
95
- rspec-mocks (3.9.1)
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.9.0)
98
- rspec-support (3.9.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 (1.8.0)
103
+ terminal-table (2.0.0)
104
104
  unicode-display_width (~> 1.1, >= 1.1.1)
105
- thor (1.0.1)
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.1.3
121
+ 2.2.3
data/README.md CHANGED
@@ -4,9 +4,7 @@ This plugin will allow you to build your assets with Webpack _after_ Jekyll has
4
4
 
5
5
  ## Why?
6
6
 
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 excample in the `spec/fixtures` folder:-
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.yml`.
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:-
10
8
 
11
9
 
12
10
  ## Installation
@@ -29,7 +27,18 @@ And add the following to your site's `_config.yml`
29
27
 
30
28
  ```yml
31
29
  plugins:
32
- - jekyll-webpack
30
+ - jekyll/webpack
31
+ ```
32
+
33
+ NOTE the `/` - the `-` variant is not available yet.
34
+
35
+ ALSO NOTE - it's probably advisable to place this plugin as the very last one in the build pipe. EG:-
36
+
37
+ ```yml
38
+ plugins:
39
+ - jekyll-otherplug
40
+ ...
41
+ - jekyll/webpack
33
42
  ```
34
43
 
35
44
  ## Usage
@@ -38,6 +47,32 @@ In your root Jekyll project folder you need to have Webpack installed, so:-
38
47
 
39
48
  `yarn add webpack webpack-cli --dev`
40
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
+ ### 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
+
41
76
  ## Development
42
77
 
43
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.
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "jekyll/webpack/version"
4
4
  require "jekyll"
5
+ require "open3"
5
6
 
6
7
  module Jekyll
7
8
  module Webpack
@@ -9,8 +10,35 @@ module Jekyll
9
10
 
10
11
  def self.build(site)
11
12
  site_dest = site.dest
12
- Dir.chdir(site_dest) do
13
- `../node_modules/.bin/webpack`
13
+
14
+ stdout, stderr, status = Open3.capture3(
15
+ "../node_modules/.bin/webpack",
16
+ chdir: File.expand_path(site_dest)
17
+ )
18
+
19
+ runtime_error = stdout =~ /ERROR in|SyntaxError/
20
+
21
+ raise Error, stderr if stderr.size > 0
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
14
42
  end
15
43
  end
16
44
  end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Webpack
3
- VERSION = "0.1.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.1.2
4
+ version: 0.2.3
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: 2020-06-09 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
@@ -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.1.2
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: []