jekyll-cloudinary 1.2.9 → 1.2.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -0
- data/lib/jekyll/cloudinary/version.rb +1 -1
- data/lib/jekyll/cloudinary.rb +13 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0f762bca7a7b7537f04638ac87150e6679949b2
|
4
|
+
data.tar.gz: 91fd8392d91e2a4589441246504a93861fcbb5e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe162d1021d9912623f1e8823d3afb413386ddb317b84e26837dbf7ed0dc1b44b04155d855b1b159485d5e25cfdf8b17391dc8e8c2605cec4c5a469af14c9e4b
|
7
|
+
data.tar.gz: f602ce4c5c671269e60e0e03b19b7bd02b6b3c660b71075df95a901de0adda0630f4bd3ba3009d142110efbae9f92351d817ecfb058bb9fd251aca8a3b9c9670
|
data/README.md
CHANGED
@@ -15,6 +15,31 @@ Here is the general syntax of this Liquid tag:
|
|
15
15
|
{% cloudinary [preset] path/to/img.jpg [attr="value"] %}
|
16
16
|
```
|
17
17
|
|
18
|
+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
19
|
+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
20
|
+
## Table of contents
|
21
|
+
|
22
|
+
- [Installation](#installation)
|
23
|
+
- [Configuration](#configuration)
|
24
|
+
- [Mandatory settings](#mandatory-settings)
|
25
|
+
- [Optional global settings](#optional-global-settings)
|
26
|
+
- [`verbose` (default: `false`)](#verbose-default-false)
|
27
|
+
- [Optional (but highly recommended) presets](#optional-but-highly-recommended-presets)
|
28
|
+
- [Default preset](#default-preset)
|
29
|
+
- [Additional presets](#additional-presets)
|
30
|
+
- [Detailed preset settings](#detailed-preset-settings)
|
31
|
+
- [`figure` (default: `auto`)](#figure-default-auto)
|
32
|
+
- [`min_size` (default: `320`)](#min_size-default-320)
|
33
|
+
- [`max_size` (default: `1200`)](#max_size-default-1200)
|
34
|
+
- [`steps` (default: `5`)](#steps-default-5)
|
35
|
+
- [`sizes` (default: `"100vw"`)](#sizes-default-100vw)
|
36
|
+
- [`attributes` (default: none)](#attributes-default-none)
|
37
|
+
- [Live example](#live-example)
|
38
|
+
- [To do](#to-do)
|
39
|
+
- [Do you use the plugin on a live site?](#do-you-use-the-plugin-on-a-live-site)
|
40
|
+
|
41
|
+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
42
|
+
|
18
43
|
## Installation
|
19
44
|
|
20
45
|
[Sign up for free on Cloudinary](http://cloudinary.com/invites/lpov9zyyucivvxsnalc5/sgyyc0j14k6p0sbt51nw). The free account should be enough for most blogs.
|
data/lib/jekyll/cloudinary.rb
CHANGED
@@ -43,7 +43,7 @@ module Jekyll
|
|
43
43
|
# Extract tag segments
|
44
44
|
markup = /^(?:(?<preset>[^\s.:\/]+)\s+)?(?<image_src>[^\s]+\.[a-zA-Z0-9]{3,4})\s*(?<html_attr>[\s\S]+)?$/.match(rendered_markup)
|
45
45
|
if !markup
|
46
|
-
Jekyll.logger.abort_with('Cloudinary', "Can't read this tag: #{@markup}")
|
46
|
+
Jekyll.logger.abort_with('[Cloudinary]', "Can't read this tag: #{@markup}")
|
47
47
|
end
|
48
48
|
|
49
49
|
image_src = markup[:image_src]
|
@@ -64,7 +64,7 @@ module Jekyll
|
|
64
64
|
natural_width = image.columns
|
65
65
|
else
|
66
66
|
natural_width = 1000000
|
67
|
-
Jekyll.logger.warn('Cloudinary', "Couldn't find this image to check its width: #{image_path}")
|
67
|
+
Jekyll.logger.warn('[Cloudinary]', "Couldn't find this image to check its width: #{image_path}")
|
68
68
|
end
|
69
69
|
|
70
70
|
if markup[:preset]
|
@@ -72,7 +72,7 @@ module Jekyll
|
|
72
72
|
preset = preset.merge(settings['presets'][markup[:preset]])
|
73
73
|
else
|
74
74
|
if settings['verbose']
|
75
|
-
Jekyll.logger.warn('Cloudinary', "'#{markup[:preset]}' preset for the Cloudinary plugin doesn't exist, using the default one")
|
75
|
+
Jekyll.logger.warn('[Cloudinary]', "'#{markup[:preset]}' preset for the Cloudinary plugin doesn't exist, using the default one")
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
@@ -127,20 +127,26 @@ module Jekyll
|
|
127
127
|
|
128
128
|
if natural_width < min_width
|
129
129
|
if settings['verbose']
|
130
|
-
Jekyll.logger.warn('Cloudinary', "Width of source image '#{File.basename(image_src)}' (#{natural_width}px) in #{context['page'].path} not enough for ANY srcset version")
|
130
|
+
Jekyll.logger.warn('[Cloudinary]', "Width of source image '#{File.basename(image_src)}' (#{natural_width}px) in #{context['page'].path} not enough for ANY srcset version")
|
131
131
|
end
|
132
|
-
srcset << "https://res.cloudinary.com/#{settings['cloud_name']}/image/fetch/q_auto,f_auto/#{image_url} #{natural_width}w"
|
132
|
+
srcset << "https://res.cloudinary.com/#{settings['cloud_name']}/image/fetch/c_scale,w_#{natural_width},q_auto,f_auto/#{image_url} #{natural_width}w"
|
133
133
|
else
|
134
|
+
missed_sizes = []
|
134
135
|
(1..steps).each do |factor|
|
135
136
|
width = min_width + (factor - 1) * step_width
|
136
137
|
if width <= natural_width
|
137
138
|
srcset << "https://res.cloudinary.com/#{settings['cloud_name']}/image/fetch/c_scale,w_#{width},q_auto,f_auto/#{image_url} #{width}w"
|
138
139
|
else
|
140
|
+
missed_sizes.push(width)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
if missed_sizes.length > 0
|
144
|
+
srcset << "https://res.cloudinary.com/#{settings['cloud_name']}/image/fetch/c_scale,w_#{natural_width},q_auto,f_auto/#{image_url} #{natural_width}w"
|
139
145
|
if settings['verbose']
|
140
|
-
Jekyll.logger.warn('Cloudinary', "Width of source image '#{File.basename(image_src)}' (#{natural_width}px) in #{context['page'].path} not enough for #{
|
146
|
+
Jekyll.logger.warn('[Cloudinary]', "Width of source image '#{File.basename(image_src)}' (#{natural_width}px) in #{context['page'].path} not enough for #{missed_sizes.join('px, ')}px version#{missed_sizes.length > 1 ? 's' : ''}")
|
141
147
|
end
|
142
148
|
end
|
143
|
-
|
149
|
+
|
144
150
|
end
|
145
151
|
srcset_string = srcset.join(",\n")
|
146
152
|
|
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.2.
|
4
|
+
version: 1.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicolas Hoizey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|