jekyll-cloudinary 1.14.0 → 1.14.1

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: 3e640939f7e90648a97629ce86753a316e32d1de8921bce56697806bab9db3a6
4
- data.tar.gz: e6a7df0f2c22042f184f96a000864069e572f8863d0e692722e533e6ef0af0a6
3
+ metadata.gz: db9db2fb49cfafd9cc44480903f194cbff72441c43f8bdcd692bbdcfaaa54b3b
4
+ data.tar.gz: fa8f0445a95244193ccf375deb218d0a2016dc1214ac1b48686b78ccd93b708d
5
5
  SHA512:
6
- metadata.gz: cbf8245a87611bca589acb5c4bef7157dbae3e9d60a835789c6355199cf11496e73a0c956b3bce62689f13c3c1526f2ecfcbfdfcb5313b6e2dc6253e8071658b
7
- data.tar.gz: 16ce834ee5b6ea407be1a9f8c2dcaab3136ae7ac197c2bfa6778cf71e1ae3b92beecd6bf96665c4664f0de6047851d8059e1d8cd7b84c73c72c0a65259a56a31
6
+ metadata.gz: fd6d92bb3c3f0d028dc52ad4ee752423fe06bc118ed7619f24fa55fe51fdce3deff9846b296c4a9ac8fea700ceaf2523e7756c52f06d1cbe26dd4fb3bf9c3188
7
+ data.tar.gz: c7bd59c5ec33b4e4eefc145e0a11ced90a2fafd52d1d394ccf325fe62a3611bbca4697d523fac18ad1de82a1cfbcdd4bc04001a6900d0863402ccc5be02272e2
data/README.md CHANGED
@@ -13,7 +13,7 @@ Here is the general syntax of this Liquid tag:
13
13
 
14
14
  <!-- {% raw %} -->
15
15
  ```liquid
16
- {% cloudinary cloudflare.png alt="Un schéma montrant l'apport de Cloudflare" caption="Un schéma montrant l'apport de Cloudflare" %}
16
+ {% cloudinary cloudflare.png alt="Un schéma montrant l'apport de Cloudflare" caption="Un schéma montrant l'apport de Cloudflare" loading="lazy" %}
17
17
  ```
18
18
  <!-- {% endraw %} -->
19
19
 
@@ -27,6 +27,7 @@ Here is the general syntax of this Liquid tag:
27
27
  - [Optional global settings](#optional-global-settings)
28
28
  - [`only_prod` (default: `false`)](#only_prod-default-false)
29
29
  - [`verbose` (default: `false`)](#verbose-default-false)
30
+ - [`origin_url`](#origin_url)
30
31
  - [Optional (but highly recommended) presets](#optional-but-highly-recommended-presets)
31
32
  - [Default preset](#default-preset)
32
33
  - [Additional presets](#additional-presets)
@@ -38,6 +39,10 @@ Here is the general syntax of this Liquid tag:
38
39
  - [`steps` (default: `5`)](#steps-default-5)
39
40
  - [`sizes` (default: `"100vw"`)](#sizes-default-100vw)
40
41
  - [`attributes` (default: none)](#attributes-default-none)
42
+ - [Liquid tag attributes](#liquid-tag-attributes)
43
+ - [Recommended attributes](#recommended-attributes)
44
+ - [Loading attribute](#loading-attribute)
45
+ - [Other interesting attributes](#other-interesting-attributes)
41
46
  - [Live example](#live-example)
42
47
  - [Contributing](#contributing)
43
48
  - [Do you use the plugin on a live site?](#do-you-use-the-plugin-on-a-live-site)
@@ -188,6 +193,7 @@ cloudinary:
188
193
  sizes: "(min-width: 50rem) 17rem, 30vw"
189
194
  attributes:
190
195
  class: "one3rd"
196
+ loading: "lazy"
191
197
  ```
192
198
 
193
199
  To use this additional preset, you will have to write this in your Markdown post:
@@ -220,7 +226,7 @@ The value can be:
220
226
  - `never`: will always generate a `<img>`, losing the caption
221
227
  - `always`: will always generate a `<figure>` and `<figcaption>`, even if there's no `caption` attribute
222
228
 
223
- If a `<figure>` is generated and there are attributes in the Liquid tag, they are added to the `<img>` if they are `alt` or `title`, or to the `<figure>`.
229
+ If a `<figure>` is generated and there are attributes (in the preset or the Liquid tag), they are added to the `<img>` if they are `alt`, `title` or `loading`, or to the `<figure>`.
224
230
 
225
231
  #### `min_width` (default: `320`)
226
232
 
@@ -234,13 +240,56 @@ If a `<figure>` is generated and there are attributes in the Liquid tag, they ar
234
240
 
235
241
  #### `attributes` (default: none)
236
242
 
237
- Attributes are added without transformation to the generated element.
243
+ You can define attributes that will be added to all images using this preset. Attributes are added without transformation to the generated element.
238
244
 
239
- You can obviously define the `alt` attribute, mandatory for accessibility, but you can also set a `title`, a `class`, `aria-*` attributes for enhanced accessibility, or even `data-*` attributes you would like to use later with CSS or JavaScript.
245
+ You should obviously not add to preset attributes that should have different values for each image, such as `alt`, `caption`, `title`, etc.
240
246
 
241
- The `caption` attribute is the only one that can act differently, depending on the `figure` setting.
247
+ You can set a `class`, `aria-*` attributes for enhanced accessibility, or even `data-*` attributes you would like to use later with CSS or JavaScript.
242
248
 
243
- `alt`, `title` and `caption` attributes can contain Markdown.
249
+ Also it's possible to pass liquid variables inside the tags, so for example if you have your picture path in the front matter (in the post markdown file), you can send it to Cloudinary Plugin, such as:
250
+ ```
251
+ {% cloudinary {{page.thumbnail}} class="post-image" itemprop="image" alt="{{page.title}} image"%}
252
+ ```
253
+
254
+
255
+ ## Liquid tag attributes
256
+
257
+ You can add attributes to the liquid tag, after the image path:
258
+
259
+ <!-- {% raw %} -->
260
+ ```liquid
261
+ {% cloudinary onethird /assets/selfie.jpg alt="My selfie" loading="eager" %}
262
+ ```
263
+ <!-- {% endraw %} -->
264
+
265
+ Just like the ones from the preset settings, inline attributes are added without transformation to the generated element.
266
+
267
+ ### Recommended attributes
268
+
269
+ You should obviously define the `alt` attribute, mandatory for accessibility.
270
+
271
+ If you want the image to be inside a `figure` element, you probably also want to add a `caption` attribute. This is the only one that can act differently than other attributes, depending on [the `figure` setting](#figure-default-auto).
272
+
273
+ You can also set a `title` attribute, but there are really few use cases for it on images.
274
+
275
+ `alt`, `caption` and `title` attributes can contain Markdown.
276
+
277
+ ### Loading attribute
278
+
279
+ The `loading` attribute allows you to tell the browser how you want it to load this image.
280
+
281
+ From [this article written by Addy Osmani](https://addyosmani.com/blog/lazy-loading/):
282
+
283
+ > The loading attribute allows a browser to defer loading offscreen images and iframes until users scroll near them. loading supports three values:
284
+ > - `lazy`: is a good candidate for lazy loading.
285
+ > - `eager`: is not a good candidate for lazy loading. Load right away.
286
+ > - `auto`: browser will determine whether or not to lazily load.
287
+ >
288
+ > Not specifying the attribute at all will have the same impact as setting loading=auto.
289
+
290
+ ### Other interesting attributes
291
+
292
+ You can also use attributes to add a `class`, `aria-*` attributes for enhanced accessibility, or even `data-*` attributes you would like to use later with CSS or JavaScript.
244
293
 
245
294
  ## Live example
246
295
 
@@ -1,5 +1,15 @@
1
1
  # Releases
2
2
 
3
+ ## [v1.14.1](https://github.com/nhoizey/jekyll-cloudinary/releases/tag/v1.14.1)
4
+
5
+ Fix the loading attribute handling.
6
+
7
+ ## [v1.14.0](https://github.com/nhoizey/jekyll-cloudinary/releases/tag/v1.14.0)
8
+
9
+ Add support for the loading attribute, for [native lazy loading](https://addyosmani.com/blog/lazy-loading/) (Thanks [@borisschapira](https://github.com/borisschapira))
10
+
11
+ Read [the documentation for the loading attribute](https://github.com/nhoizey/jekyll-cloudinary/blob/master/README.md#loading-attribute).
12
+
3
13
  ## [v1.13.0](https://github.com/nhoizey/jekyll-cloudinary/releases/tag/v1.13.0)
4
14
 
5
15
  Add cross-origin support to prevent opaque responses in Service Workers.
@@ -187,6 +187,10 @@ module Jekyll
187
187
  img_attr << " title=\"#{html_attr["title"]}\""
188
188
  html_attr.delete("title")
189
189
  end
190
+ if html_attr["loading"]
191
+ img_attr << " loading=\"#{html_attr["loading"]}\""
192
+ html_attr.delete("loading")
193
+ end
190
194
 
191
195
  attr_string = html_attr.map { |a, v| "#{a}=\"#{v}\"" }.join(" ")
192
196
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Cloudinary
5
- VERSION = "1.14.0"
5
+ VERSION = "1.14.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-cloudinary
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.0
4
+ version: 1.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Hoizey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-09 00:00:00.000000000 Z
11
+ date: 2019-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastimage
@@ -28,16 +28,22 @@ dependencies:
28
28
  name: jekyll
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3.6'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '5'
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - "~>"
41
+ - - ">="
39
42
  - !ruby/object:Gem::Version
40
43
  version: '3.6'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '5'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: bundler
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +78,14 @@ dependencies:
72
78
  requirements:
73
79
  - - "~>"
74
80
  - !ruby/object:Gem::Version
75
- version: 0.55.0
81
+ version: 0.74.0
76
82
  type: :development
77
83
  prerelease: false
78
84
  version_requirements: !ruby/object:Gem::Requirement
79
85
  requirements:
80
86
  - - "~>"
81
87
  - !ruby/object:Gem::Version
82
- version: 0.55.0
88
+ version: 0.74.0
83
89
  description: |2
84
90
  This Jekyll plugin adds a Liquid tag that helps using Cloudinary, a SaaS solution for images management and transformation.
85
91
 
@@ -117,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
123
  - !ruby/object:Gem::Version
118
124
  version: '0'
119
125
  requirements: []
120
- rubygems_version: 3.0.2
126
+ rubygems_version: 3.0.4
121
127
  signing_key:
122
128
  specification_version: 4
123
129
  summary: Jekyll plugin adding a Liquid tag for Cloudinary, for better responsive images