jekyll-minibundle 2.2.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +162 -63
  3. data/README.md +62 -57
  4. data/Rakefile +27 -14
  5. data/jekyll-minibundle.gemspec +15 -13
  6. data/lib/jekyll/minibundle.rb +2 -0
  7. data/lib/jekyll/minibundle/asset_bundle.rb +16 -10
  8. data/lib/jekyll/minibundle/asset_file_drop.rb +5 -2
  9. data/lib/jekyll/minibundle/asset_file_properties.rb +2 -0
  10. data/lib/jekyll/minibundle/asset_file_registry.rb +9 -7
  11. data/lib/jekyll/minibundle/asset_stamp.rb +2 -0
  12. data/lib/jekyll/minibundle/asset_tag_markup.rb +6 -4
  13. data/lib/jekyll/minibundle/bundle_file.rb +8 -0
  14. data/lib/jekyll/minibundle/development_file.rb +4 -0
  15. data/lib/jekyll/minibundle/development_file_collection.rb +2 -0
  16. data/lib/jekyll/minibundle/environment.rb +5 -1
  17. data/lib/jekyll/minibundle/exceptions.rb +2 -0
  18. data/lib/jekyll/minibundle/files.rb +2 -0
  19. data/lib/jekyll/minibundle/hashes.rb +3 -0
  20. data/lib/jekyll/minibundle/log.rb +3 -1
  21. data/lib/jekyll/minibundle/mini_bundle_block.rb +8 -1
  22. data/lib/jekyll/minibundle/mini_stamp_tag.rb +3 -1
  23. data/lib/jekyll/minibundle/stamp_file.rb +4 -0
  24. data/lib/jekyll/minibundle/variable_template.rb +15 -12
  25. data/lib/jekyll/minibundle/variable_template_registry.rb +2 -0
  26. data/lib/jekyll/minibundle/version.rb +3 -1
  27. data/test/fixture/site/_bin/remove_comments +1 -0
  28. data/test/fixture/site/_bin/with_count +1 -0
  29. data/test/fixture/site/_config.yml +2 -1
  30. data/test/integration/minibundle_development_mode_test.rb +115 -29
  31. data/test/integration/minibundle_production_mode_test.rb +157 -69
  32. data/test/integration/ministamp_development_mode_test.rb +4 -2
  33. data/test/integration/ministamp_production_mode_test.rb +6 -4
  34. data/test/integration/static_files_as_asset_sources_test.rb +6 -4
  35. data/test/support/assertions.rb +2 -0
  36. data/test/support/fixture_config.rb +14 -12
  37. data/test/support/static_file_config.rb +18 -16
  38. data/test/support/test_case.rb +5 -3
  39. data/test/unit/asset_bundle_test.rb +14 -12
  40. data/test/unit/asset_file_drop_test.rb +4 -3
  41. data/test/unit/asset_file_registry_test.rb +16 -19
  42. data/test/unit/asset_tag_markup_test.rb +8 -6
  43. data/test/unit/bundle_file_properties_test.rb +6 -4
  44. data/test/unit/bundle_file_writing_test.rb +6 -4
  45. data/test/unit/development_file_properties_test.rb +5 -3
  46. data/test/unit/development_file_writing_test.rb +4 -2
  47. data/test/unit/environment_test.rb +6 -4
  48. data/test/unit/files_test.rb +3 -1
  49. data/test/unit/hashes_test.rb +3 -1
  50. data/test/unit/jekyll_static_file_api_test.rb +13 -9
  51. data/test/unit/mini_bundle_block_test.rb +42 -35
  52. data/test/unit/mini_stamp_tag_test.rb +4 -2
  53. data/test/unit/stamp_file_properties_test.rb +5 -3
  54. data/test/unit/stamp_file_writing_test.rb +4 -2
  55. data/test/unit/variable_template_test.rb +8 -8
  56. metadata +13 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 774c41fc9b64c1637821907e5cbd27b1cc57fb3c
4
- data.tar.gz: 507bd31ab11d4c7b3c7944116af11ff63fd27f0c
2
+ SHA256:
3
+ metadata.gz: 997ab9ce6b810501fe2ef0177f8982cf5cae5b7f98871ca84c160e15dd90852a
4
+ data.tar.gz: eeedab2288ea816ffb94568ddc80a5a4a560e4701bb7b5a9c07875100e191338
5
5
  SHA512:
6
- metadata.gz: 95c4db067065b679412388f72629cf3eafa12cf99c1d6bad244715b2917fca09f41e13f97e6d3ee28d7fc2df191a7532576fe999327cc2c2f7e6100ea6488ff8
7
- data.tar.gz: 26b81832194d0e5d86dc1d99ecdb6de65e463c8ef228190b7b84e98dfdf63ae908e4be5f59bd1ba1a4bdb488ada439cf9b29079604d5e08776819aa21f4985bd
6
+ metadata.gz: 4cc289086a2222a0f1e67df53135143da8248a9989e8ebd02839ab10260e2090ab83198f1b1cf271a6792a566d9b2182b28e62cb89cb62a4b42597a99a10bb60
7
+ data.tar.gz: 90af2278865d5be704c6d36263b9df905d61d28d28914f7584b10640770fb3af7fc129d3c798abcddda57b8d713193df17b4b22ddf9b1c70eb4ffcb0638bb29b
@@ -1,27 +1,57 @@
1
- # 2.2.0 / 2017-03-10
1
+ # Changelog
2
2
 
3
- * Treat `ministamp` tag's argument as YAML, resulting either in String
4
- or Hash type of argument after YAML parsing. If argument is of Hash
5
- type, render values with Liquid-like templating support, allowing
6
- rendering Liquid variables. This change is backwards compatible.
3
+ This project adheres to [Semantic Versioning].
4
+
5
+ ## [Unreleased]
6
+
7
+ ## [v3.0.0] - 2020-09-06
8
+
9
+ No functional changes, only minor refactorings since v2.2.0. Dropping
10
+ support for Ruby MRI < 2.4 causes major version bump.
11
+
12
+ ### Added
13
+
14
+ * Increase test coverage.
15
+
16
+ ### Changed
17
+
18
+ * Hygienic refactorings: use frozen string literals, prefer squiggly
19
+ heredocs over non-squiggly ones, adhere to the RuboCop linter.
20
+
21
+ ### Removed
22
+
23
+ * Drop support for Ruby MRI versions below 2.4.
24
+
25
+ ## [v2.2.0] - 2017-03-10
26
+
27
+ ### Added
7
28
 
8
29
  * Add support for separating asset destination path from the generated
9
30
  asset URL. See `render_basename_only` option of `ministamp` tag and
10
31
  `destination_baseurl` option of `minibundle` block.
11
32
 
12
- * Escape the URLs generated by `ministamp` tag and `minibundle` block.
33
+ ### Changed
13
34
 
35
+ * Treat `ministamp` tag's argument as YAML, resulting either in String
36
+ or Hash type of argument after YAML parsing. If argument is of Hash
37
+ type, render values with Liquid-like templating support, allowing
38
+ rendering Liquid variables. This change is backwards compatible.
39
+ * Escape the URLs generated by `ministamp` tag and `minibundle` block.
14
40
  * Quote paths in error messages more consistently.
15
-
16
41
  * Show better error messages in various situations when asset source
17
42
  file does not exist.
18
-
19
43
  * Compatibility: conform to Jekyll 3.4.2's StaticFile public API.
20
44
 
21
- # 2.1.2 / 2017-02-28
45
+ ## [v2.1.2] - 2017-02-28
22
46
 
23
- * Bug fix: remove unnecessary '.' path component from asset destination
24
- path. This manifested when the asset destination had no subdirectory.
47
+ ### Added
48
+
49
+ * Show bundle destination path in bundling log message.
50
+
51
+ ### Fixed
52
+
53
+ * Remove unnecessary '.' path component from asset destination path.
54
+ This manifested when the asset destination had no subdirectory.
25
55
  Affects `ministamp` tag and `minibundle` block.
26
56
 
27
57
  Example situation:
@@ -41,131 +71,159 @@
41
71
  ```
42
72
  <link href="/site-6a204bd89f3c8348afd5c77c717a097a.css" rel="stylesheet">
43
73
  ```
74
+ * Related to above: Don't let Jekyll's watch mode (auto-regeneration)
75
+ remove asset from generated site directory when asset destination path
76
+ has no subdirectory.
44
77
 
45
- * Bug fix (related to above): don't let Jekyll's watch mode
46
- (auto-regeneration) remove asset from generated site directory when
47
- asset destination path has no subdirectory.
78
+ ## [v2.1.1] - 2017-01-14
48
79
 
49
- * Show bundle destination path in bundling log message.
80
+ ### Changed
81
+
82
+ * Compatibility: conform to Jekyll 3.3's StaticFile public API.
50
83
 
51
- # 2.1.1 / 2017-01-14
84
+ ### Fixed
52
85
 
53
86
  * Fix the file permissions of `minibundle` block's output file to
54
87
  respect umask setting. Bug report from Alfonse Surigao.
55
88
 
56
- * Compatibility: conform to Jekyll 3.3's StaticFile public API.
89
+ ## [v2.1.0] - 2016-05-04
57
90
 
58
- # 2.1.0 / 2016-05-04
91
+ ### Changed
59
92
 
60
93
  * Allow attributes without values. Useful for `async` attribute, for
61
94
  example. Pull Request #7 by Sam (@codewisdom).
62
95
 
96
+ ### Fixed
97
+
63
98
  * Ensure attribute value conversion to string.
64
99
 
65
- # 2.0.1 / 2016-04-06
100
+ ## [v2.0.1] - 2016-04-06
101
+
102
+ ### Fixed
66
103
 
67
104
  * Fix Jekyll version requirement check to be more reliable.
68
105
 
69
- # 2.0.0 / 2016-04-01
106
+ ## [v2.0.0] - 2016-04-01
70
107
 
71
- * Drop support for Jekyll versions below 3.
108
+ ### Changed
72
109
 
73
110
  * Remove unused asset cache entries and temporary files when Jekyll
74
111
  rebuilds the site.
75
-
76
112
  * Document a known caveat: the plugin doesn't work with Jekyll's
77
113
  incremental rebuild feature.
78
114
 
79
- # 1.6.0 / 2016-03-26
115
+ ### Removed
116
+
117
+ * Drop support for Jekyll versions below 3.
118
+
119
+ ## [v1.6.0] - 2016-03-26
120
+
121
+ ### Changed
80
122
 
81
123
  * Log the last 2000 bytes of minifier's STDOUT output if the minifier
82
124
  command fails. Pull Request #6 by Martin Nordholts (@Enselic).
83
-
84
125
  * Allow prepending base URL for the destination path of `minibundle`
85
126
  block.
86
127
 
128
+ ### Removed
129
+
87
130
  * Drop Ruby MRI 1.9 support because Jekyll 3 does not support it.
88
131
 
132
+ ### Fixed
133
+
89
134
  * Fix issues in asset reloading in Jekyll's watch (auto-regeneration)
90
135
  mode, doing bundling and asset fingerprinting again.
91
136
 
92
- # 1.5.1 / 2015-01-29
137
+ ## [v1.5.1] - 2015-01-29
138
+
139
+ ### Changed
93
140
 
94
141
  * Improve future compatibility with Jekyll. Minibundle has classes
95
142
  adhering to `Jekyll::StaticFile` interface, and some method
96
143
  implementations of the interface were missing.
97
-
98
144
  * Small refactorings and test improvements.
99
145
 
100
- # 1.5.0 / 2014-07-27
146
+ ## [v1.5.0] - 2014-07-27
147
+
148
+ ### Added
101
149
 
102
150
  * Support minifier command specification in `_config.yml` and inside
103
151
  `minibundle` block. Issue #4 by Phillip Smith (@phillipadsmith).
104
-
105
152
  * Support enabling development mode from `_config.yml`.
106
-
107
153
  * Add argument validation to `minibundle` block and `ministamp` tag.
108
-
109
154
  * Document how to load the gem with Jekyll's `gems` config setting.
110
155
 
111
- # 1.4.6 / 2014-05-10
156
+ ## [v1.4.6] - 2014-05-10
157
+
158
+ ### Changed
112
159
 
113
160
  * Handle compatibility issues with safe_yaml and logger flexibly. This
114
161
  should allow using the plugin with Jekyll 1.0 and 2.0.
115
162
 
116
- # 1.4.5 / 2014-05-10
163
+ ## [v1.4.5] - 2014-05-10
164
+
165
+ ### Changed
117
166
 
118
167
  * Use SafeYAML to load user input from `minibundle` block for
119
168
  consistent behavior with Jekyll and for security.
120
-
121
169
  * Clean log messages: show relative paths when bundling assets.
122
170
 
171
+ ### Fixed
172
+
123
173
  * Add missing implementations of `relative_path` and `to_liquid`
124
174
  methods from Jekyll's StaticFile API (introduced in Jekyll v1.5.0),
125
175
  allowing Minibundle to behave better with other Jekyll
126
176
  plugins. Issue #3 by Michael Rose (@mmistakes).
127
-
128
177
  * Fix Ruby deprecation warnings (use `File.exist?` instead of
129
178
  `File.exists?`).
130
179
 
131
- # 1.4.4 / 2014-01-16
180
+ ## [v1.4.4] - 2014-01-16
181
+
182
+ ### Changed
132
183
 
133
184
  * Conserve memory when calculating fingerprint for an asset.
134
185
  Previously, we read the whole asset file into memory and then
135
186
  calculated the MD5 digest. This is bad for big assets. Now, we read
136
187
  the file in chunks.
137
188
 
138
- # 1.4.3 / 2014-01-16
189
+ ## [v1.4.3] - 2014-01-16
139
190
 
140
- * Do not leak read pipe file descriptor upon minifier command failure.
191
+ ### Changed
141
192
 
142
193
  * Loosen version constraints for development gem dependencies.
143
-
144
194
  * Clarify documentation.
195
+ * Minor internal state handling improvements.
196
+ * Clarify tests, increase test coverage.
145
197
 
198
+ ### Fixed
199
+
200
+ * Do not leak read pipe file descriptor upon minifier command failure.
146
201
  * Fix some Ruby coding style issues.
147
202
 
148
- * Minor internal state handling improvements.
203
+ ## [v1.4.2] - 2013-12-28
149
204
 
150
- * Clarify tests, increase test coverage.
205
+ ### Changed
151
206
 
152
- # 1.4.2 / 2013-12-28
207
+ * Separate tags produced by `minibundle` in development mode with
208
+ newlines.
209
+ * Clarify tests, increase coverage.
210
+
211
+ ### Fixed
153
212
 
154
213
  * Ensure touching asset source triggers destination write. This was an
155
214
  unintentional edge case earlier. Now the behavior of touching the
156
215
  asset source is consistent with when changing the contents of the
157
216
  source.
158
217
 
159
- * Separate tags produced by `minibundle` in development mode with
160
- newlines.
161
-
162
- * Clarify tests, increase coverage.
218
+ ## [v1.4.1] - 2013-12-27
163
219
 
164
- # 1.4.1 / 2013-12-27
220
+ ### Fixed
165
221
 
166
222
  * Add missing files to gem package.
167
223
 
168
- # 1.4.0 / 2013-12-27
224
+ ## [v1.4.0] - 2013-12-27
225
+
226
+ ### Fixed
169
227
 
170
228
  * Fix bug causing exception to be thrown when `ministamp` or
171
229
  `minibundle` is called twice with same asset source argument. Allow
@@ -173,55 +231,96 @@
173
231
  (remove the restriction introduced in 1.3.0). Issue #2 by Austin
174
232
  Grigg (@agrigg).
175
233
 
176
- # 1.3.0 / 2013-12-25
234
+ ## [v1.3.0] - 2013-12-25
235
+
236
+ ### Changed
237
+
238
+ * Upgrade development dependencies.
239
+
240
+ ### Fixed
177
241
 
178
242
  * Disallow handling asset source files that are already static files
179
243
  in Jekyll. Otherwise, we would potentially get to inconsistencies in
180
244
  Jekyll's watch mode. See "Jekyll static file restriction" in
181
245
  README.md. Issue #2 by Austin Grigg (@agrigg).
182
246
 
183
- * Upgrade development dependencies.
247
+ ## [v1.2.0] - 2013-09-29
184
248
 
185
- # 1.2.0 / 2013-09-29
249
+ ### Changed
186
250
 
187
251
  * If Jekyll's logger is available, use it for nice output when bundling.
188
-
189
252
  * Upgrade development dependencies.
190
-
191
253
  * Simplify `BundleFile` class implementation.
192
254
 
193
- # 1.1.0 / 2013-02-27
255
+ ## [v1.1.0] - 2013-02-27
256
+
257
+ ### Added
194
258
 
195
259
  * `ministamp` tag omits fingerprint in development mode.
196
260
 
197
- * Clarify documentation.
261
+ ### Changed
198
262
 
263
+ * Clarify documentation.
199
264
  * Comply with (Gemnasium) conventions for changelogs. Pull Request #1
200
265
  by Teemu Matilainen (@tmatilai).
201
266
 
202
- * Bug fix: do not bundle assets when nonrelated files change.
267
+ ### Fixed
203
268
 
204
- * Bug fix: do not bundle assets twice upon startup.
269
+ * Don't bundle assets when nonrelated files change.
270
+ * Don't bundle assets twice upon startup.
205
271
 
206
- # 1.0.0 / 2013-02-15
272
+ ## [v1.0.0] - 2013-02-15
273
+
274
+ ### Added
207
275
 
208
276
  * Add development mode, where `minibundle` block will copy each asset
209
277
  as-is to the destination directory.
210
278
 
211
- * Clarify documentation.
279
+ ### Changed
212
280
 
281
+ * Clarify documentation.
213
282
  * Increase test coverage.
214
283
 
215
- # 0.2.0 / 2012-12-15
284
+ ## [v0.2.0] - 2012-12-15
216
285
 
217
- * Escape the values of custom attributes given in `minibundle` block.
286
+ ### Added
218
287
 
219
288
  * Add semicolons between each JavaScript asset in bundling.
220
-
221
289
  * Show error in page output if asset bundling command failed.
222
290
 
223
- # 0.1.0 / 2012-12-07
291
+ ### Changed
224
292
 
225
- * Add `ministamp` tag and `minibundle` block for Jekyll.
293
+ * Escape the values of custom attributes given in `minibundle` block.
294
+
295
+ ## [v0.1.0] - 2012-12-07
296
+
297
+ ### Added
226
298
 
299
+ * Add `ministamp` tag and `minibundle` block for Jekyll.
227
300
  * First release.
301
+
302
+ [Semantic Versioning]: https://semver.org/spec/v2.0.0.html
303
+ [Unreleased]: https://github.com/tkareine/jekyll-minibundle/compare/v3.0.0...HEAD
304
+ [v3.0.0]: https://github.com/tkareine/jekyll-minibundle/compare/v2.2.0...v3.0.0
305
+ [v2.2.0]: https://github.com/tkareine/jekyll-minibundle/compare/v2.1.2...v2.2.0
306
+ [v2.1.2]: https://github.com/tkareine/jekyll-minibundle/compare/v2.1.1...v2.1.2
307
+ [v2.1.1]: https://github.com/tkareine/jekyll-minibundle/compare/v2.1.0...v2.1.1
308
+ [v2.1.0]: https://github.com/tkareine/jekyll-minibundle/compare/v2.0.1...v2.1.0
309
+ [v2.0.1]: https://github.com/tkareine/jekyll-minibundle/compare/v2.0.0...v2.0.1
310
+ [v2.0.0]: https://github.com/tkareine/jekyll-minibundle/compare/v1.6.0...v2.0.0
311
+ [v1.6.0]: https://github.com/tkareine/jekyll-minibundle/compare/v1.5.1...v1.6.0
312
+ [v1.5.1]: https://github.com/tkareine/jekyll-minibundle/compare/v1.5.0...v1.5.1
313
+ [v1.5.0]: https://github.com/tkareine/jekyll-minibundle/compare/v1.4.6...v1.5.0
314
+ [v1.4.6]: https://github.com/tkareine/jekyll-minibundle/compare/v1.4.5...v1.4.6
315
+ [v1.4.5]: https://github.com/tkareine/jekyll-minibundle/compare/v1.4.4...v1.4.5
316
+ [v1.4.4]: https://github.com/tkareine/jekyll-minibundle/compare/v1.4.3...v1.4.4
317
+ [v1.4.3]: https://github.com/tkareine/jekyll-minibundle/compare/v1.4.2...v1.4.3
318
+ [v1.4.2]: https://github.com/tkareine/jekyll-minibundle/compare/v1.4.1...v1.4.2
319
+ [v1.4.1]: https://github.com/tkareine/jekyll-minibundle/compare/v1.4.0...v1.4.1
320
+ [v1.4.0]: https://github.com/tkareine/jekyll-minibundle/compare/v1.3.0...v1.4.0
321
+ [v1.3.0]: https://github.com/tkareine/jekyll-minibundle/compare/v1.2.0...v1.3.0
322
+ [v1.2.0]: https://github.com/tkareine/jekyll-minibundle/compare/v1.1.0...v1.2.0
323
+ [v1.1.0]: https://github.com/tkareine/jekyll-minibundle/compare/v1.0.0...v1.1.0
324
+ [v1.0.0]: https://github.com/tkareine/jekyll-minibundle/compare/v0.2.0...v1.0.0
325
+ [v0.2.0]: https://github.com/tkareine/jekyll-minibundle/compare/v0.1.0...v0.2.0
326
+ [v0.1.0]: https://github.com/tkareine/jekyll-minibundle/releases/tag/v0.1.0
data/README.md CHANGED
@@ -1,23 +1,22 @@
1
1
  # Jekyll Minibundle plugin
2
2
 
3
- A straightforward asset bundling plugin for [Jekyll][Jekyll], utilizing
4
- external minification tool of your choice. It provides asset
5
- concatenation for bundling and asset fingerprinting with MD5 digest for
6
- cache busting.
3
+ [![Gem version](https://badge.fury.io/rb/jekyll-minibundle.svg)][MinibundleGem]
4
+ [![CI](https://github.com/tkareine/jekyll-minibundle/workflows/CI/badge.svg)][MinibundleCI]
5
+
6
+ A straightforward asset bundling plugin for [Jekyll], utilizing external
7
+ minification tool of your choice. It provides asset concatenation for
8
+ bundling and asset fingerprinting with MD5 digest for cache busting.
7
9
 
8
10
  There are no runtime dependencies, except for the minification tool used
9
11
  for bundling (fingerprinting has no dependencies).
10
12
 
11
- The plugin requires Jekyll version 3.x. It is tested with Ruby MRI
12
- 2.x. Ruby 1.8 and 1.9 are *not* supported.
13
+ The plugin requires Jekyll version 3 or 4. It is tested with Ruby MRI
14
+ 2.4 and later.
13
15
 
14
16
  The plugin works with Jekyll's watch mode (auto-regeneration, Jekyll
15
17
  option `--watch`), but not with incremental feature enabled (Jekyll
16
18
  option `--incremental`).
17
19
 
18
- [![Gem version](https://badge.fury.io/rb/jekyll-minibundle.svg)][MinibundleGem]
19
- [![Build status](https://secure.travis-ci.org/tkareine/jekyll-minibundle.svg)][MinibundleBuild]
20
-
21
20
  ## Features
22
21
 
23
22
  There are two features: asset fingerprinting with [MD5 digest][MD5] over
@@ -26,10 +25,10 @@ feature.
26
25
 
27
26
  Asset bundling consists of concatenation and minification. The plugin
28
27
  implements concatenation and leaves choosing the minification tool up to
29
- you. [UglifyJS2][UglifyJS2] is a good and fast minifier, for
30
- example. The plugin connects to the minifier with standard unix pipe,
31
- feeding asset file contents to it in desired order via standard input,
32
- and reads the result from standard output.
28
+ you. [UglifyJS][UglifyJS2] is a good and fast minifier, for example. The
29
+ plugin connects to the minifier with standard unix pipe, feeding asset
30
+ file contents to it in desired order via standard input, and reads the
31
+ result from standard output.
33
32
 
34
33
  Why is this good? A fingerprint in asset's path is
35
34
  the [recommended way][GoogleWebFundamentalsHttpCaching] to handle
@@ -46,21 +45,25 @@ sources makes asset sizes smaller and thus faster to load over network.
46
45
 
47
46
  The plugin ships as a [RubyGem][MinibundleGem]. To install:
48
47
 
49
- ``` bash
50
- $ gem install jekyll-minibundle
51
- ```
48
+ 1. Add the following line to the [Gemfile] of your site:
52
49
 
53
- (You should use [Bundler][Bundler] to manage the gems in your project.)
50
+ ``` ruby
51
+ gem 'jekyll-minibundle'
52
+ ```
54
53
 
55
- Then, instruct Jekyll to load the gem by adding this line to the
56
- [configuration file][JekyllConf] of your Jekyll site project
57
- (`_config.yml`):
54
+ 2. Run `bundle install`.
58
55
 
59
- ``` yaml
60
- gems: ['jekyll/minibundle']
61
- ```
56
+ 3. Instruct Jekyll to load the gem by adding this line to the
57
+ [configuration file][JekyllConf] of your site (`_config.yml`):
58
+
59
+ ``` yaml
60
+ plugins:
61
+ - jekyll/minibundle
62
+ ```
62
63
 
63
- An alternative to using the `gems` configuration option is to add
64
+ (Use the `gems` key instead of `plugins` for Jekyll older than v3.5.0.)
65
+
66
+ An alternative to using the `plugins` configuration option is to add
64
67
  `_plugins/minibundle.rb` file to your site project with this line:
65
68
 
66
69
  ``` ruby
@@ -68,12 +71,12 @@ require 'jekyll/minibundle'
68
71
  ```
69
72
 
70
73
  You must allow Jekyll to use custom plugins. That is, do not enable
71
- Jekyll's `safe` option.
74
+ Jekyll's `safe` configuration option.
72
75
 
73
76
  ### Asset fingerprinting
74
77
 
75
78
  If you just want to have an MD5 fingerprint in your asset's path, use
76
- `ministamp` [Liquid][Liquid] tag in a Liquid template file. For example:
79
+ `ministamp` [Liquid] tag in a Liquid template file. For example:
77
80
 
78
81
  ``` liquid
79
82
  <link rel="stylesheet" href="{{ site.baseurl }}/{% ministamp _assets/site.css assets/site.css %}" media="screen, projection">
@@ -94,8 +97,8 @@ empty:
94
97
  ```
95
98
 
96
99
  This feature is useful when combined with asset generation tools
97
- external to Jekyll. For example, you can configure [Sass][Sass] to take
98
- input files from `_assets/styles/*.scss` and to produce output to
100
+ external to Jekyll. For example, you can configure [Sass] to take input
101
+ files from `_assets/styles/*.scss` and to produce output to
99
102
  `_tmp/site.css`. Then, you use `ministamp` tag to copy the file with a
100
103
  fingerprint to Jekyll's site destination directory:
101
104
 
@@ -105,11 +108,11 @@ fingerprint to Jekyll's site destination directory:
105
108
 
106
109
  #### `ministamp` call syntax
107
110
 
108
- The argument for `ministamp` tag must be in [YAML][YAML] syntax, and
109
- parsing the argument as YAML must result either in a String or a
110
- Hash. What you saw previously was the argument being parsed as a String;
111
- it's effectively a shorthand version of passing the argument as a Hash
112
- with certain keys. That is, in the following call:
111
+ The argument for `ministamp` tag must be in [YAML] syntax, and parsing
112
+ the argument as YAML must result either in a String or a Hash. What you
113
+ saw previously was the argument being parsed as a String; it's
114
+ effectively a shorthand version of passing the argument as a Hash with
115
+ certain keys. That is, in the following call:
113
116
 
114
117
  ``` liquid
115
118
  {% ministamp _tmp/site.css assets/site.css %}
@@ -166,10 +169,10 @@ appear. The markup tag contains the path to the bundle file, and the
166
169
  Jekyll's site destination directory will have the bundle file at that
167
170
  path. The path will contain an MD5 fingerprint.
168
171
 
169
- Place `minibundle` [Liquid][Liquid] block into the Liquid template file
170
- where you want the block's generated markup to appear. Write bundling
171
- configuration inside the block in [YAML][YAML] syntax. For example, to
172
- bundle a set of JavaScript sources:
172
+ Place `minibundle` [Liquid] block into the Liquid template file where
173
+ you want the block's generated markup to appear. Write bundling
174
+ configuration inside the block in [YAML] syntax. For example, to bundle
175
+ a set of JavaScript sources:
173
176
 
174
177
  ``` text
175
178
  {% minibundle js %}
@@ -193,7 +196,7 @@ baseurl: ''
193
196
 
194
197
  minibundle:
195
198
  minifier_commands:
196
- js: node_modules/.bin/uglifyjs -
199
+ js: node_modules/.bin/uglifyjs
197
200
  ```
198
201
 
199
202
  When it's time to render the `minibundle` block, the plugin launches the
@@ -244,23 +247,24 @@ And then specify the minifier command in `_config.yml`:
244
247
  minibundle:
245
248
  minifier_commands:
246
249
  css: _bin/remove_whitespace
247
- js: node_modules/.bin/uglifyjs -
250
+ js: node_modules/.bin/uglifyjs
248
251
  ```
249
252
 
250
253
  #### `minibundle` call syntax
251
254
 
252
255
  Use `css` or `js` as the argument to the opening tag, for example `{% minibundle css %}`.
253
256
 
254
- The block contents must be in [YAML][YAML] syntax. The supported keys are:
257
+ The block contents must be in [YAML] syntax. The supported keys are:
255
258
 
256
259
  | Key | Value type | Value example | Default value | Description |
257
260
  | --- | --- | --- | --- | --- |
258
- | `source_dir` | string | - | `'_assets'` | The source directory of `assets`, relative to the site directory. |
261
+ | `source_dir` | string | - | `'_assets'` | The source directory of `assets`, relative to the site directory. You can use period (`.`) to select the site directory itself. |
262
+ | `assets` | array of strings | `['deps/one', 'deps/two', 'app']` | `[]` | Array of assets relative to `source_dir` directory, without type extension. These are the asset files to be bundled, in order, into one bundle destination file. |
259
263
  | `destination_path` | string | - | `'assets/site'` | The destination path of the bundle file, without type extension, relative to Jekyll's site destination directory. If the value begins with `/` and `baseurl` is empty, `baseurl` will be set to `'/'` implicitly. |
260
- | `baseurl` | string | `{{ site.baseurl }}/` | `''` | If nonempty, the bundle destination URL inside `minibundle`'s rendered HTML element will be this value prepended to the destination path of the bundle file. Ignored if `destination_baseurl` is nonempty. |
264
+ | `baseurl` | string | `'{{ site.baseurl }}/'` | `''` | If nonempty, the bundle destination URL inside `minibundle`'s rendered HTML element will be this value prepended to the destination path of the bundle file. Ignored if `destination_baseurl` is nonempty. |
261
265
  | `destination_baseurl` | string | `'{{ site.cdn_baseurl }}/'` | `''` | If nonempty, the bundle destination URL inside `minibundle`'s rendered HTML element will be this value prepended to the basename of the bundle destination path. See [Separating asset destination path from generated URL](#separating-asset-destination-path-from-generated-url) for more. |
262
- | `assets` | array of strings | `['dependency', 'app']` | `[]` | Array of the basenames of assets in `source_dir` directory, without type extension. These are the asset files to be bundled, in order, into one bundle destination file. |
263
266
  | `attributes` | map of keys to string values | `{id: my-link, media: screen}` | `{}` | Custom HTML element attributes to be added to `minibundle`'s rendered HTML element. |
267
+ | `minifier_cmd` | string | `'node_modules/.bin/uglifyjs'` | - | Minifier command specific to this bundle. See [Minifier command specification](#minifier-command-specification) for more. |
264
268
 
265
269
  ### Minifier command specification
266
270
 
@@ -272,14 +276,14 @@ You can specify minifier commands in three places:
272
276
  minibundle:
273
277
  minifier_commands:
274
278
  css: _bin/remove_whitespace
275
- js: node_modules/.bin/uglifyjs -
279
+ js: node_modules/.bin/uglifyjs
276
280
  ```
277
281
 
278
282
  2. as environment variables:
279
283
 
280
284
  ``` bash
281
285
  export JEKYLL_MINIBUNDLE_CMD_CSS=_bin/remove_whitespace
282
- export JEKYLL_MINIBUNDLE_CMD_JS="node_modules/.bin/uglifyjs -"
286
+ export JEKYLL_MINIBUNDLE_CMD_JS="node_modules/.bin/uglifyjs"
283
287
  ```
284
288
 
285
289
  3. inside the `minibundle` block with `minifier_cmd` option, allowing
@@ -289,7 +293,7 @@ You can specify minifier commands in three places:
289
293
  {% minibundle js %}
290
294
  source_dir: _assets/scripts
291
295
  destination_path: assets/site
292
- minifier_cmd: node_modules/.bin/uglifyjs -
296
+ minifier_cmd: node_modules/.bin/uglifyjs
293
297
  assets:
294
298
  - dependency
295
299
  - app
@@ -385,10 +389,10 @@ Should both be defined, the setting from the environment variable wins.
385
389
  ### Variable templating
386
390
 
387
391
  The template engine used by `ministamp` tag's Hash argument has syntax
388
- resembling the ones of [Liquid][Liquid] and [Mustache][Mustache], with
389
- `{{` and `}}` tags surrounding the variable to be substituted into the
390
- output string. For example, given Liquid variable `var = 'foo'`, the
391
- template `begin{{ var }}end` results in `beginfooend`.
392
+ resembling the ones of [Liquid] and [Mustache], with `{{` and `}}` tags
393
+ surrounding the variable to be substituted into the output string. For
394
+ example, given Liquid variable `var = 'foo'`, the template `begin{{ var
395
+ }}end` results in `beginfooend`.
392
396
 
393
397
  The engine supports variable substitution only. It does not support
394
398
  other expressions. If you need to, you can write complex expressions in
@@ -489,20 +493,21 @@ The plugin does not work with Jekyll's incremental rebuild feature
489
493
 
490
494
  ## License
491
495
 
492
- MIT. See `LICENSE.txt`.
496
+ MIT. See [LICENSE.txt].
493
497
 
494
- [Bundler]: http://bundler.io/
495
- [GoogleWebFundamentalsHttpCaching]: https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching#invalidating-and-updating-cached-responses
498
+ [Gemfile]: https://bundler.io/gemfile.html
499
+ [GoogleWebFundamentalsHttpCaching]: https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching#invalidating_and_updating_cached_responses
496
500
  [JekyllConf]: https://jekyllrb.com/docs/configuration/
497
501
  [JekyllMinibundleExampleSite]: https://github.com/tkareine/jekyll-minibundle-example
498
502
  [Jekyll]: https://jekyllrb.com/
499
- [Liquid]: https://shopify.github.io/liquid/
503
+ [LICENSE.txt]: https://raw.githubusercontent.com/tkareine/jekyll-minibundle/master/LICENSE.txt
500
504
  [LiquidAssignTag]: https://shopify.github.io/liquid/tags/variable/#assign
501
505
  [LiquidCaptureBlock]: https://shopify.github.io/liquid/tags/variable/#capture
506
+ [Liquid]: https://shopify.github.io/liquid/
502
507
  [MD5]: https://en.wikipedia.org/wiki/MD5
503
- [MinibundleBuild]: https://travis-ci.org/tkareine/jekyll-minibundle
508
+ [MinibundleCI]: https://github.com/tkareine/jekyll-minibundle/actions?workflow=CI
504
509
  [MinibundleGem]: https://rubygems.org/gems/jekyll-minibundle
505
510
  [Mustache]: https://mustache.github.io/
506
- [Sass]: http://sass-lang.com/
511
+ [Sass]: https://sass-lang.com/
507
512
  [UglifyJS2]: https://github.com/mishoo/UglifyJS2
508
- [YAML]: http://www.yaml.org/
513
+ [YAML]: https://yaml.org/