kamifusen 0.9.1 → 0.9.2

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: fba4cc594fa4ab1ae8205a187f84b2815265127fed09c3cc3a46da87808068f1
4
- data.tar.gz: d82f0bf97ded7f442deb90c6647918ceb312a5197a2e313bee1adebb40b1e4d2
3
+ metadata.gz: 61185a31bdae5117672878baf5e5f05bf66e1ae8288420d54b9614a8be040176
4
+ data.tar.gz: 4a50a5934a684287b428503d17f0f25c400089b17d69ebffd3b14ebebae19436
5
5
  SHA512:
6
- metadata.gz: dc71b4eba1b972abf61e8204e69940589e35828d8200b47aff400524402fd071890972988d0c7af978ae602e1b11ef64ecc4229a58ee705509f639de5daa772a
7
- data.tar.gz: 2d6bd8e27099ccfe668c1066fbd4b6e5a9456956a54d084e00bef16e3ffd3203c12210b985801d42d843fac6e290c3e263d94a4159f042a0e32839745d2742e0
6
+ metadata.gz: d7ada36299ca1dd019e5dc36431b86bb7af361eef886a92056a1c79066ae83b1e5453ed0320739bed31b0393905ace82fa91a4e7c2dc1b4da259f946a124a986
7
+ data.tar.gz: 3d8845a6231bc7429bb6977aaa0289ca9bef05cda5daaf56bd287921c266930365043f848734a4a33b50a9382cfe161d893af8e1282d59b2aed2d8bf2d1a34ed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- Kamifusen (0.1.1)
4
+ kamifusen (0.9.2)
5
5
  image_processing
6
6
  rails
7
7
 
@@ -94,7 +94,7 @@ GEM
94
94
  mini_mime (1.0.3)
95
95
  minitest (5.14.4)
96
96
  nio4r (2.5.7)
97
- nokogiri (1.11.4-x86_64-darwin)
97
+ nokogiri (1.11.6-x86_64-darwin)
98
98
  racc (~> 1.4)
99
99
  parallel (1.20.1)
100
100
  parser (3.0.1.1)
@@ -162,7 +162,7 @@ GEM
162
162
  tzinfo (2.0.4)
163
163
  concurrent-ruby (~> 1.0)
164
164
  unicode-display_width (2.0.0)
165
- websocket-driver (0.7.3)
165
+ websocket-driver (0.7.4)
166
166
  websocket-extensions (>= 0.1.0)
167
167
  websocket-extensions (0.1.5)
168
168
  zeitwerk (2.4.2)
@@ -171,7 +171,7 @@ PLATFORMS
171
171
  x86_64-darwin-20
172
172
 
173
173
  DEPENDENCIES
174
- Kamifusen!
174
+ kamifusen!
175
175
  listen
176
176
  rake (~> 13.0)
177
177
  rubocop (~> 1.7)
@@ -1,18 +1,33 @@
1
1
  <%
2
2
  # image_tag options
3
+ options ||= {}
3
4
  alt = options[:alt]
4
5
  width = options[:width]
5
6
  height = options[:height]
6
- # kamifusen settings
7
- sizes = [320, 576, 640, 768, 992, 1152, 1200, 1400, 1536, 1984, 2400]
8
- quality = 80
9
- # Computing
10
- sizes.reject! { |size| size > width * 2 } if width
11
- webps = sizes.map { |size| "#{ url_for source.variant(resize: "#{size}>", format: :webp, quality: quality) } #{ size } vw" }.join(', ')
12
- jpgs = sizes.map { |size| "#{ url_for source.variant(resize: "#{size}>", format: :jpg, quality: quality) } #{ size } vw" }.join(', ')
13
- default = url_for source.variant(resize: "#{sizes.max}>", format: :jpg, quality: quality)
7
+ klass = options[:class]
8
+ parameters = " loading=\"lazy\" decoding=\"async\""
9
+ parameters += " alt=\"#{ options[:alt] }\"" if alt
10
+ parameters += " width=\"#{ options[:width] }\"" if width
11
+ parameters += " height=\"#{ options[:height]}\"" if height
12
+ parameters += " class=\"#{ options[:class] }\"" if klass
14
13
  %>
15
- <picture>
16
- <source srcset="<%= webps %>">
17
- <img src="<%= default %>" srcset="<%= jpgs %>" alt="<%= alt %>" loading="lazy" decoding="async"<%= raw " width=\"#{ width }\"" if width %><%= raw " height=\"#{ height}\"" if height %>>
18
- </picture>
14
+ <% if source.variable? %>
15
+ <%
16
+ # kamifusen settings
17
+ sizes = [320, 576, 640, 768, 992, 1152, 1200, 1400, 1536, 1984, 2400]
18
+ quality = 80
19
+ # Computing
20
+ sizes.reject! { |size| size > width * 2 } if width
21
+ webps = sizes.map { |size| "#{ url_for source.variant(resize: "#{size}>", format: :webp, quality: quality) } #{ size } vw" }.join(', ')
22
+ jpgs = sizes.map { |size| "#{ url_for source.variant(resize: "#{size}>", format: :jpg, quality: quality) } #{ size } vw" }.join(', ')
23
+ default = url_for source.variant(resize: "#{sizes.max}>", format: :jpg, quality: quality)
24
+ %>
25
+ <picture>
26
+ <source srcset="<%= webps %>">
27
+ <img src="<%= default %>" srcset="<%= jpgs %>"<%= raw parameters %>>
28
+ </picture>
29
+ <% else %>
30
+ <picture>
31
+ <img src="<%= url_for source %>"<%= raw parameters %>>
32
+ </picture>
33
+ <% end %>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kamifusen
4
- VERSION = "0.9.1"
4
+ VERSION = "0.9.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kamifusen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sébastien Moulène
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2021-05-26 00:00:00.000000000 Z
12
+ date: 2021-05-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails