jekyll-cloudinary 1.1.0 → 1.1.1
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.
- checksums.yaml +4 -4
- data/README.md +38 -10
- data/lib/jekyll/cloudinary/version.rb +1 -1
- data/lib/jekyll/cloudinary.rb +9 -2
- 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: ccd0b8fa58e43ef68c0f5abb5b54974b6c5e7fc0
|
4
|
+
data.tar.gz: bfc0d0d82dfd31822b0ff9d18aa4495167c620ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d7e398b4644f245a19c777a73a86bd15d604e5739e7e30dc92c3dd0ca6362fdb1be88314862bacc9ba31401217f5e1caf2e2581399f939a6aa77b849c0d89ee
|
7
|
+
data.tar.gz: 273a2a4eb61ff108b6713b18c8b94b454cfc96f9eafb4be2a110cad35d9ccd227cf201eafddea482ec5f2ed145ea4eee91b5e90d8cdccded194a174ab8f2e9ee
|
data/README.md
CHANGED
@@ -6,6 +6,12 @@ It builds the HTML for responsive images in the posts, using the `srcset` and `s
|
|
6
6
|
|
7
7
|
You are in full control of the number of generated images and their size, and the `sizes` attribute that helps the browser decide which image to download. See the complete configuration options for details.
|
8
8
|
|
9
|
+
Here is the general syntax of this Liquid tag:
|
10
|
+
|
11
|
+
```liquid
|
12
|
+
{% cloudinary [preset] path/to/img.jpg [attr="value"] %}
|
13
|
+
```
|
14
|
+
|
9
15
|
## Using Jekyll Cloudinary
|
10
16
|
|
11
17
|
[Sign up for free on Cloudinary](http://cloudinary.com/invites/lpov9zyyucivvxsnalc5/sgyyc0j14k6p0sbt51nw). The free account should be enough for mosts blogs.
|
@@ -40,13 +46,17 @@ cloudinary:
|
|
40
46
|
verbose: true
|
41
47
|
```
|
42
48
|
|
43
|
-
#### `auto`
|
44
|
-
|
45
49
|
#### `verbose`
|
46
50
|
|
47
51
|
|
48
52
|
### Optional (but highly recommended) presets
|
49
53
|
|
54
|
+
You can now define the presets you need for your posts' images, starting with the default one:
|
55
|
+
|
56
|
+
#### Default preset
|
57
|
+
|
58
|
+
The default preset is the one you don't even have to mention when using the Liquid tag, and that will be used if a preset you use in the tag doesn't exist.
|
59
|
+
|
50
60
|
```yaml
|
51
61
|
cloudinary:
|
52
62
|
…
|
@@ -56,6 +66,30 @@ cloudinary:
|
|
56
66
|
max_size: 1600
|
57
67
|
steps: 5
|
58
68
|
sizes: "(min-width: 50rem) 50rem, 90vw"
|
69
|
+
```
|
70
|
+
|
71
|
+
This preset will generate five images 320 to 1600 pixels wide in the `srcset` and define `sizes` as `"(min-width: 50rem) 50rem, 90vw"`.
|
72
|
+
|
73
|
+
With this preset, you only have to write this in your Markdown post:
|
74
|
+
|
75
|
+
```liquid
|
76
|
+
{% cloudinary /assets/img.jpg %}
|
77
|
+
```
|
78
|
+
|
79
|
+
To get this HTML:
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
#### Additional presets
|
85
|
+
|
86
|
+
You can add other presets if you need several image sizes in your posts, here is an example for images that take only one third of the post width:
|
87
|
+
|
88
|
+
```yaml
|
89
|
+
cloudinary:
|
90
|
+
…
|
91
|
+
presets:
|
92
|
+
…
|
59
93
|
onethird:
|
60
94
|
min_size: 110
|
61
95
|
max_size: 535
|
@@ -75,17 +109,11 @@ cloudinary:
|
|
75
109
|
|
76
110
|
#### `attributes`
|
77
111
|
|
78
|
-
## Usage
|
79
|
-
|
80
|
-
This is the Liquid tag syntax:
|
81
|
-
|
82
|
-
```Liquid
|
83
|
-
{% cloudinary [preset] path/to/img.jpg [attr="value"] %}
|
84
|
-
```
|
85
112
|
|
86
113
|
## Examples
|
87
114
|
|
88
|
-
```
|
115
|
+
```liquid
|
89
116
|
{% cloudinary image1.jpg alt="alternate" %}
|
90
117
|
{% cloudinary onethird image2.jpg alt="other" title="yet another one" %}
|
91
118
|
```
|
119
|
+
|
data/lib/jekyll/cloudinary.rb
CHANGED
@@ -58,8 +58,15 @@ module Jekyll
|
|
58
58
|
end
|
59
59
|
|
60
60
|
# Get source image natural width
|
61
|
-
|
62
|
-
|
61
|
+
if File.exist?(image_path)
|
62
|
+
image = Magick::Image::read(image_path).first
|
63
|
+
natural_width = image.columns
|
64
|
+
else
|
65
|
+
natural_width = 100000
|
66
|
+
if settings['verbose']
|
67
|
+
puts "\n[Cloudinary] 'Couldn\'t find this image to check its width: #{image_path}"
|
68
|
+
end
|
69
|
+
end
|
63
70
|
|
64
71
|
if markup[:preset]
|
65
72
|
if settings['presets'][markup[:preset]]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-cloudinary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicolas Hoizey
|
@@ -72,7 +72,7 @@ files:
|
|
72
72
|
- lib/jekyll-cloudinary.rb
|
73
73
|
- lib/jekyll/cloudinary.rb
|
74
74
|
- lib/jekyll/cloudinary/version.rb
|
75
|
-
homepage:
|
75
|
+
homepage: https://nhoizey.github.io/jekyll-cloudinary/
|
76
76
|
licenses:
|
77
77
|
- MIT
|
78
78
|
metadata: {}
|