jekyll-assets 3.0.5 → 3.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +2 -1
  3. data/LICENSE +1 -1
  4. data/README.md +136 -149
  5. data/Rakefile +37 -5
  6. data/lib/jekyll-assets.rb +1 -1
  7. data/lib/jekyll/assets.rb +14 -3
  8. data/lib/jekyll/assets/config.rb +1 -1
  9. data/lib/jekyll/assets/context.rb +1 -1
  10. data/lib/jekyll/assets/default.rb +1 -1
  11. data/lib/jekyll/assets/drop.rb +1 -1
  12. data/lib/jekyll/assets/env.rb +52 -19
  13. data/lib/jekyll/assets/extensible.rb +1 -1
  14. data/lib/jekyll/assets/filters.rb +1 -1
  15. data/lib/jekyll/assets/hook.rb +31 -3
  16. data/lib/jekyll/assets/html.rb +1 -1
  17. data/lib/jekyll/assets/logger.rb +52 -10
  18. data/lib/jekyll/assets/manifest.rb +1 -1
  19. data/lib/jekyll/assets/map.rb +2 -2
  20. data/lib/jekyll/assets/map/css.rb +1 -1
  21. data/lib/jekyll/assets/map/javascript.rb +1 -1
  22. data/lib/jekyll/assets/map/writer.rb +2 -2
  23. data/lib/jekyll/assets/patches/asset.rb +1 -1
  24. data/lib/jekyll/assets/patches/cached.rb +4 -4
  25. data/lib/jekyll/assets/patches/find_asset.rb +1 -1
  26. data/lib/jekyll/assets/patches/functions.rb +1 -1
  27. data/lib/jekyll/assets/patches/obsolete.rb +1 -1
  28. data/lib/jekyll/assets/patches/site.rb +1 -1
  29. data/lib/jekyll/assets/plugins.rb +1 -1
  30. data/lib/jekyll/assets/plugins/bootstrap.rb +3 -3
  31. data/lib/jekyll/assets/plugins/closure_comments.rb +32 -0
  32. data/lib/jekyll/assets/plugins/font-awesome.rb +2 -2
  33. data/lib/jekyll/assets/plugins/frontmatter.rb +1 -1
  34. data/lib/jekyll/assets/plugins/html/audio.rb +1 -1
  35. data/lib/jekyll/assets/plugins/html/component.rb +1 -1
  36. data/lib/jekyll/assets/plugins/html/css.rb +1 -1
  37. data/lib/jekyll/assets/plugins/html/defaults/audio.rb +1 -1
  38. data/lib/jekyll/assets/plugins/html/defaults/component.rb +1 -1
  39. data/lib/jekyll/assets/plugins/html/defaults/css.rb +1 -1
  40. data/lib/jekyll/assets/plugins/html/defaults/favicon.rb +1 -1
  41. data/lib/jekyll/assets/plugins/html/defaults/img.rb +2 -2
  42. data/lib/jekyll/assets/plugins/html/defaults/js.rb +1 -1
  43. data/lib/jekyll/assets/plugins/html/defaults/vid.rb +1 -1
  44. data/lib/jekyll/assets/plugins/html/favicon.rb +1 -1
  45. data/lib/jekyll/assets/plugins/html/img.rb +2 -2
  46. data/lib/jekyll/assets/plugins/html/js.rb +1 -1
  47. data/lib/jekyll/assets/plugins/html/pic.rb +1 -1
  48. data/lib/jekyll/assets/plugins/html/svg.rb +1 -1
  49. data/lib/jekyll/assets/plugins/html/vid.rb +1 -1
  50. data/lib/jekyll/assets/plugins/liquid.rb +1 -1
  51. data/lib/jekyll/assets/plugins/magick.rb +2 -2
  52. data/lib/jekyll/assets/plugins/optim.rb +2 -2
  53. data/lib/jekyll/assets/plugins/prefixer.rb +2 -2
  54. data/lib/jekyll/assets/plugins/proxy/magick.rb +1 -1
  55. data/lib/jekyll/assets/plugins/proxy/optim.rb +1 -1
  56. data/lib/jekyll/assets/plugins/searcher.rb +17 -3
  57. data/lib/jekyll/assets/proxy.rb +1 -1
  58. data/lib/jekyll/assets/reader.rb +33 -0
  59. data/lib/jekyll/assets/tag.rb +54 -13
  60. data/lib/jekyll/assets/url.rb +2 -7
  61. data/lib/jekyll/assets/utils.rb +16 -23
  62. data/lib/jekyll/assets/version.rb +2 -2
  63. data/lib/jekyll/assets/writer.rb +46 -0
  64. metadata +6 -3
@@ -1,14 +1,9 @@
1
1
  # Frozen-string-literal: true
2
- # Copyright: 2012 - 2017 - MIT License
2
+ # Copyright: 2012 - 2018 - MIT License
3
3
  # Encoding: utf-8
4
4
 
5
5
  module Jekyll
6
6
  module Assets
7
- # --
8
- # Inherits from and overrides some of Sprockets asset,
9
- # this way we can have some external assets that do not
10
- # break the way we work or the way Sprockets works.
11
- # --
12
7
  class Url < Sprockets::Asset
13
8
  alias hexdigest id
14
9
  alias digest_path filename
@@ -16,7 +11,7 @@ module Jekyll
16
11
  alias digest id
17
12
 
18
13
  def integrity
19
- nil
14
+ ""
20
15
  end
21
16
  end
22
17
  end
@@ -1,10 +1,20 @@
1
1
  # Frozen-string-literal: true
2
- # Copyright: 2012 - 2017 - MIT License
2
+ # Copyright: 2012 - 2018 - MIT License
3
3
  # Encoding: utf-8
4
4
 
5
5
  module Jekyll
6
6
  module Assets
7
7
  module Utils
8
+ def self.activate(gem)
9
+ return unless Gem::Specification.find_all_by_name(gem)&.any? ||
10
+ Gem::Specification.find_by_path(gem)&.any?
11
+
12
+ require gem
13
+ if block_given?
14
+ yield
15
+ end
16
+ end
17
+
8
18
  def self.html_fragment(*a)
9
19
  Nokogiri::HTML.fragment(*a) do |c|
10
20
  c.options = Nokogiri::XML::ParseOptions::NONET | \
@@ -294,34 +304,17 @@ module Jekyll
294
304
  out
295
305
  end
296
306
 
297
- # --
298
- # rubocop:enable Metrics/AbcSize
299
- # Either require the file or keep moving along.
300
- # @yield a block of code if the require works out.
301
- # @param [String] file the file to require.
302
- # @return [nil]
303
- # --
304
- module_function
305
- def try_require(file)
306
- require file
307
- if block_given?
308
- yield
309
- end
310
- rescue LoadError
311
- Logger.debug "Unable to load file `#{file}'"
312
- end
313
-
314
307
  # --
315
308
  # @yield a blockof code if the require works out.
316
309
  # Either require exec.js, and the file or move along.
317
310
  # @param [String] file the file to require.
318
311
  # @return [nil]
319
312
  # --
320
- module_function
321
- def javascript?
322
- require "execjs"
323
- if block_given?
324
- yield
313
+ def self.javascript?
314
+ activate "execjs" do
315
+ if block_given?
316
+ yield
317
+ end
325
318
  end
326
319
  rescue ExecJS::RuntimeUnavailable
327
320
  nil
@@ -1,9 +1,9 @@
1
1
  # Frozen-string-literal: true
2
- # Copyright: 2012 - 2017 - MIT License
2
+ # Copyright: 2012 - 2018 - MIT License
3
3
  # Encoding: utf-8
4
4
 
5
5
  module Jekyll
6
6
  module Assets
7
- VERSION = "3.0.5"
7
+ VERSION = "3.0.6"
8
8
  end
9
9
  end
@@ -0,0 +1,46 @@
1
+ # Frozen-string-literal: true
2
+ # Copyright: 2012 - 2018 - MIT License
3
+ # Encoding: utf-8
4
+
5
+ module SprocketsExportersFileExporterPatches
6
+ def skip?(logger)
7
+ return true if File.exist?(target)
8
+ logger.debug "Writing asset to #{target}"
9
+ false
10
+ end
11
+
12
+ # --
13
+ def call
14
+ before_hook(asset, env: environment)
15
+ after_hook(out = super, {
16
+ env: environment, asset: asset
17
+ })
18
+
19
+ out
20
+ end
21
+
22
+ # --
23
+ private
24
+ def before_hook(asset, env:)
25
+ Jekyll::Assets::Hook.trigger :asset, :before_write do |v|
26
+ v.call(asset, env)
27
+ end
28
+ end
29
+
30
+ # --
31
+ private
32
+ def after_hook(out, asset:, env:)
33
+ Jekyll::Assets::Hook.trigger :asset, :after_write do |v|
34
+ v.call(out, asset, env)
35
+ end
36
+ end
37
+ end
38
+
39
+ # --
40
+ module Sprockets
41
+ module Exporters
42
+ class FileExporter
43
+ prepend SprocketsExportersFileExporterPatches
44
+ end
45
+ end
46
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.5
4
+ version: 3.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordon Bedwell
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-12-05 00:00:00.000000000 Z
13
+ date: 2018-01-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: execjs
@@ -225,6 +225,7 @@ files:
225
225
  - lib/jekyll/assets/patches/site.rb
226
226
  - lib/jekyll/assets/plugins.rb
227
227
  - lib/jekyll/assets/plugins/bootstrap.rb
228
+ - lib/jekyll/assets/plugins/closure_comments.rb
228
229
  - lib/jekyll/assets/plugins/font-awesome.rb
229
230
  - lib/jekyll/assets/plugins/frontmatter.rb
230
231
  - lib/jekyll/assets/plugins/html/audio.rb
@@ -251,10 +252,12 @@ files:
251
252
  - lib/jekyll/assets/plugins/proxy/optim.rb
252
253
  - lib/jekyll/assets/plugins/searcher.rb
253
254
  - lib/jekyll/assets/proxy.rb
255
+ - lib/jekyll/assets/reader.rb
254
256
  - lib/jekyll/assets/tag.rb
255
257
  - lib/jekyll/assets/url.rb
256
258
  - lib/jekyll/assets/utils.rb
257
259
  - lib/jekyll/assets/version.rb
260
+ - lib/jekyll/assets/writer.rb
258
261
  homepage: http://github.com/jekyll/jekyll-assets/
259
262
  licenses:
260
263
  - MIT
@@ -275,7 +278,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
275
278
  version: '0'
276
279
  requirements: []
277
280
  rubyforge_project:
278
- rubygems_version: 2.6.13
281
+ rubygems_version: 2.7.4
279
282
  signing_key:
280
283
  specification_version: 4
281
284
  summary: Assets for Jekyll