jekyll_picture_tag 1.7.0 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.solargraph.yml +15 -0
- data/docs/Gemfile +4 -0
- data/docs/Gemfile.lock +154 -0
- data/docs/_config.yml +13 -0
- data/docs/_layouts/directory.html +32 -0
- data/docs/assets/style.css +31 -0
- data/{contributing.md → docs/contributing.md} +18 -10
- data/docs/{examples/_data/picture.yml → example_presets.md} +35 -24
- data/docs/global_configuration.md +6 -1
- data/docs/index.md +108 -0
- data/docs/installation.md +22 -22
- data/docs/migration.md +4 -0
- data/docs/notes.md +57 -61
- data/docs/output.md +52 -0
- data/docs/presets.md +79 -180
- data/docs/releases.md +49 -0
- data/docs/usage.md +59 -77
- data/jekyll_picture_tag.gemspec +2 -1
- data/lib/jekyll_picture_tag/instructions/html_attributes.rb +14 -8
- data/lib/jekyll_picture_tag/version.rb +1 -1
- data/readme.md +14 -192
- metadata +29 -9
- data/docs/examples/_config.yml +0 -10
- data/docs/examples/post.md +0 -46
- data/docs/readme.md +0 -23
data/docs/notes.md
CHANGED
@@ -1,85 +1,81 @@
|
|
1
|
+
---
|
2
|
+
---
|
1
3
|
# Notes and FAQ
|
2
4
|
|
3
|
-
|
5
|
+
* #### Github Pages?
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
+
Github Pages only allows a very short whitelist of plugins, which sadly does not include JPT. You
|
8
|
+
can either run it locally, then commit and push the generated files (rather than the source
|
9
|
+
files), or just host it some other way. I recommend Netlify.
|
7
10
|
|
8
|
-
*
|
9
|
-
to either the relevant preset or under `picture` in `_config.yml`.
|
11
|
+
* #### HTML attributes
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
element (such as a `<picture>`) surrounded by a span level element (such as an `<a>`), and horribly
|
18
|
-
mangles it. The fix for this is to tell Kramdown to chill with a `{::nomarkdown}..{:/nomarkdown}`
|
19
|
-
wrapper.
|
20
|
-
|
21
|
-
Jekyll Picture Tag can be called from many different places: a markdown file, an HTML file, an HTML
|
22
|
-
layout for a markdown file, and an HTML include, to name a few. JPT tries its best to determine
|
23
|
-
whether its output will be parsed by Kramdown or not, but Jekyll itself doesn't make this
|
24
|
-
particularly easy which results in some false positives. (The one I'm most aware of is when a
|
25
|
-
markdown file uses an HTML layout which includes a picture tag.)
|
13
|
+
Jekyll Picture Tag has comprehensive attribute support for all generated HTML. You can add
|
14
|
+
attributes both through the [liquid tag]({{ site.baseurl }}/usage), and the [preset]({{
|
15
|
+
site.baseurl }}/presets) (scroll down a bi make sure that your hosting
|
16
|
+
provider makes those images available during the build process. Netlify, for example, does not.
|
17
|
+
You won't find this out until you have gone through the entire migration process and try to deploy
|
18
|
+
for the first time.
|
26
19
|
|
27
|
-
Unfortunately, I don't see an easy way to fix this. We've gotten this far mostly by trial and error.
|
28
|
-
I'll continue to work on improving the autodetection, but you can override this behavior explicitly.
|
29
20
|
|
30
|
-
####
|
21
|
+
* #### Extra {::nomarkdown} tags or mangled HTML?
|
31
22
|
|
32
|
-
|
33
|
-
|
34
|
-
* The image will be wrapped in an anchor tag (i.e. `link_source_image:` or a `--link` parameter)
|
35
|
-
* This behavior hasn't been explicitly disabled.
|
23
|
+
**TLDR up front:** There's a bug involving `<picture>` tags wrapped in `<a>` tags which is not in my
|
24
|
+
power to fix.
|
36
25
|
|
37
|
-
|
38
|
-
`_config.yml`.
|
26
|
+
* If you're getting extra `{::nomarkdown}` tags floating around your images, add `nomarkdown:
|
27
|
+
false` to either the relevant preset or under `picture` in `_config.yml`.
|
39
28
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
29
|
+
* If you're getting mangled HTML when trying to wrap images with anchor tags, add `nomarkdown:
|
30
|
+
true` to the preset.
|
31
|
+
|
32
|
+
**What's going on here:**
|
44
33
|
|
45
|
-
|
46
|
-
|
47
|
-
|
34
|
+
Kramdown is Jekyll's default markdown parser. Kramdown gets grumpy when you give it a block level
|
35
|
+
element (such as a `<picture>`) surrounded by a span level element (such as an `<a>`), and horribly
|
36
|
+
mangles it. The fix for this is to tell Kramdown to chill with a `{::nomarkdown}..{:/nomarkdown}`
|
37
|
+
wrapper.
|
48
38
|
|
49
|
-
|
39
|
+
Jekyll Picture Tag can be called from many different places: a markdown file, an HTML file, an HTML
|
40
|
+
layout for a markdown file, and an HTML include, to name a few. JPT tries its best to determine
|
41
|
+
whether its output will be parsed by Kramdown or not, but Jekyll itself doesn't make this
|
42
|
+
particularly easy which results in some false positives. (The one I'm most aware of is when a
|
43
|
+
markdown file uses an HTML layout which includes a picture tag.)
|
50
44
|
|
51
|
-
|
52
|
-
|
53
|
-
won't find this out until you have gone through the entire migration process and try to deploy for
|
54
|
-
the first time.
|
45
|
+
Unfortunately, I don't see an easy way to fix this. We've gotten this far mostly by trial and error.
|
46
|
+
I'll continue to work on improving the autodetection, but you can override this behavior explicitly.
|
55
47
|
|
56
|
-
|
48
|
+
**The fix:**
|
57
49
|
|
58
|
-
|
59
|
-
|
50
|
+
By default, JPT will add a `{::nomarkdown}` tag if all of the following are true:
|
51
|
+
* It thinks it's called from a markdown page
|
52
|
+
* The image will be wrapped in an anchor tag (i.e. `link_source_image:` or a `--link` parameter)
|
53
|
+
* This behavior hasn't been explicitly disabled.
|
60
54
|
|
61
|
-
|
55
|
+
You can disable nomarkdown tags globally by setting `nomarkdown: false` under the `picture:` key in
|
56
|
+
`_config.yml`.
|
62
57
|
|
63
|
-
|
64
|
-
|
58
|
+
You can enable or disable markdown tags per preset by adding `nomarkdown: true|false` to them.
|
59
|
+
**This setting overrides everything else, both JPT autodetection and the global setting.**
|
65
60
|
|
66
|
-
|
61
|
+
* ### Managing Generated Images
|
67
62
|
|
68
|
-
Jekyll Picture Tag creates resized versions of your images when you build the site. It uses a
|
69
|
-
caching system to speed up site compilation, and re-uses images as much as possible.
|
70
|
-
take the following format:
|
63
|
+
Jekyll Picture Tag creates resized versions of your images when you build the site. It uses a
|
64
|
+
smart caching system to speed up site compilation, and re-uses images as much as possible.
|
65
|
+
Filenames take the following format:
|
71
66
|
|
72
|
-
`(original
|
67
|
+
`(original name without extension)-(width)-(source hash).(filetype)`
|
73
68
|
|
74
|
-
Source hash is the first 5 characters of an md5 checksum of the source image.
|
69
|
+
Source hash is the first 5 characters of an md5 checksum of the source image.
|
75
70
|
|
76
|
-
Try to use a base image that is larger than the largest resized image you need. Jekyll Picture Tag
|
77
|
-
will warn you if a base image is too small, and won't upscale images.
|
71
|
+
Try to use a base image that is larger than the largest resized image you need. Jekyll Picture Tag
|
72
|
+
will warn you if a base image is too small, and won't upscale images.
|
78
73
|
|
79
|
-
By specifying a `source` directory that is ignored by Jekyll you can prevent huge base images from
|
80
|
-
being copied to the compiled site. For example, `source: assets/images/_fullsize` and `output:
|
81
|
-
generated` will result in a compiled site that contains resized images but not the originals. Note
|
82
|
-
that this will break source image linking, if you wish to enable it. (Can't link to images that
|
83
|
-
aren't public!)
|
74
|
+
By specifying a `source` directory that is ignored by Jekyll you can prevent huge base images from
|
75
|
+
being copied to the compiled site. For example, `source: assets/images/_fullsize` and `output:
|
76
|
+
generated` will result in a compiled site that contains resized images but not the originals. Note
|
77
|
+
that this will break source image linking, if you wish to enable it. (Can't link to images that
|
78
|
+
aren't public!)
|
84
79
|
|
85
|
-
The `output` directory is never deleted by Jekyll. You may want to empty it once in awhile, to
|
80
|
+
The `output` directory is never deleted by Jekyll. You may want to empty it once in awhile, to
|
81
|
+
clear out unused images.
|
data/docs/output.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
---
|
2
|
+
---
|
3
|
+
|
4
|
+
# Output Formats
|
5
|
+
|
6
|
+
This is a listing of the various text arrangements that JPT can give you. Select one by setting
|
7
|
+
`markup:` in the relevant [markup preset]({{ site.baseurl }}/presets).
|
8
|
+
|
9
|
+
Example:
|
10
|
+
|
11
|
+
```yml
|
12
|
+
# /_data/picture.yml
|
13
|
+
|
14
|
+
markup_presets:
|
15
|
+
my_preset:
|
16
|
+
markup: data_auto
|
17
|
+
```
|
18
|
+
|
19
|
+
## Standard HTML:
|
20
|
+
|
21
|
+
* **`picture`:** `<picture>` element surrounding a `<source>` tag for each required srcset, and a
|
22
|
+
fallback `<img>`.
|
23
|
+
|
24
|
+
* **`img`:** output a single `<img>` tag with a `srcset` entry.
|
25
|
+
|
26
|
+
* **`auto`:** Supply an img tag when you have only one srcset, otherwise supply a picture tag.
|
27
|
+
|
28
|
+
## Javascript Friendly:
|
29
|
+
|
30
|
+
* **`data_picture`, `data_img`, `data_auto`:** Analogous to their counterparts, but instead of
|
31
|
+
`src`, `srcset`, and `sizes`, you get `data-src`, `data-srcset`, and `data-sizes`. This allows you
|
32
|
+
to use javascript for things like [lazy loading](https://github.com/verlok/lazyload). Include a
|
33
|
+
basic `img` fallback within a `<noscript>` tag by setting `noscript: true` in the preset. This
|
34
|
+
allows you to keep working images for your non-javascript-enabled users.
|
35
|
+
|
36
|
+
*Example:*
|
37
|
+
|
38
|
+
```yml
|
39
|
+
# /_data/picture.yml
|
40
|
+
markup_presets:
|
41
|
+
lazy:
|
42
|
+
markup: data_auto
|
43
|
+
noscript: true
|
44
|
+
```
|
45
|
+
|
46
|
+
## Fragments:
|
47
|
+
|
48
|
+
* `direct_url`: Generates an image and returns only its url. Uses `fallback_` properties (width
|
49
|
+
and format).
|
50
|
+
|
51
|
+
* `naked_srcset`: Builds a srcset and nothing else (not even the surrounding quotes). Note that the
|
52
|
+
(image) `format` setting must still be an array, even if you only give it one value.
|
data/docs/presets.md
CHANGED
@@ -1,71 +1,28 @@
|
|
1
|
+
---
|
2
|
+
---
|
3
|
+
|
1
4
|
# Writing Presets
|
2
5
|
|
3
|
-
Presets are
|
4
|
-
|
6
|
+
Presets are named collections of settings that determine basically everything about JPT's output.
|
7
|
+
They are stored in `_data/picture.yml`, to avoid cluttering `_config.yml`. You will have to create
|
8
|
+
this file, and probably the `_data/` directory as well.
|
5
9
|
|
6
|
-
|
10
|
+
Here's an [example data file]({{ site.baseurl }}/example_presets).
|
7
11
|
|
8
12
|
## Required Knowledge
|
9
13
|
|
10
|
-
If you don't
|
11
|
-
|
12
|
-
guide](https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images)
|
13
|
-
|
14
|
-
If you don't know the difference between resolution switching and art direction, stop now and read it
|
14
|
+
If you don't know the difference between resolution switching and art direction, stop now and read
|
15
|
+
the [MDN Responsive Images
|
16
|
+
guide](https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images)
|
15
17
|
in detail. Ideally, play around with a basic HTML file, a few test images, and a few different
|
16
18
|
browser widths until you understand it.
|
17
19
|
|
18
|
-
## Example settings
|
19
|
-
|
20
|
-
A more thorough example can be found under `docs/examples/_data/picture.yml`.
|
21
|
-
|
22
|
-
```yml
|
23
|
-
|
24
|
-
# _data/picture.yml
|
25
|
-
|
26
|
-
media_presets:
|
27
|
-
wide_desktop: 'min-width: 1801px'
|
28
|
-
desktop: 'max-width: 1800px'
|
29
|
-
wide_tablet: 'max-width: 1200px'
|
30
|
-
tablet: 'max-width: 900px'
|
31
|
-
mobile: 'max-width: 600px'
|
32
|
-
|
33
|
-
markup_presets:
|
34
|
-
default:
|
35
|
-
formats: [webp, original]
|
36
|
-
widths: [200, 400, 800, 1600]
|
37
|
-
media_widths:
|
38
|
-
mobile: [200, 400, 600]
|
39
|
-
tablet: [400, 600, 800]
|
40
|
-
size: 800px
|
41
|
-
sizes:
|
42
|
-
mobile: 100vw
|
43
|
-
desktop: 60vw
|
44
|
-
attributes:
|
45
|
-
picture: 'class="awesome" data-volume="11"'
|
46
|
-
img: 'class="some-other-class"'
|
47
|
-
|
48
|
-
icon:
|
49
|
-
base-width: 20
|
50
|
-
pixel_ratios: [1, 1.5, 2]
|
51
|
-
|
52
|
-
lazy:
|
53
|
-
markup: data_auto
|
54
|
-
formats: [webp, original]
|
55
|
-
widths: [200, 400, 600, 800]
|
56
|
-
noscript: true
|
57
|
-
attributes:
|
58
|
-
img: class="lazy"
|
59
|
-
|
60
|
-
```
|
61
|
-
|
62
20
|
## Media Presets
|
63
21
|
|
64
22
|
*Format:*
|
65
23
|
|
66
24
|
```yml
|
67
25
|
media_presets:
|
68
|
-
(name): (css media query)
|
69
26
|
(name): (css media query)
|
70
27
|
(name): (css media query)
|
71
28
|
(...)
|
@@ -79,12 +36,9 @@ media_presets:
|
|
79
36
|
desktop: 'min-width: 1200px'
|
80
37
|
```
|
81
38
|
|
82
|
-
These are named media queries for use in a few different places
|
83
|
-
|
84
|
-
|
85
|
-
These are used for specifying alternate source images in your liquid tag, and for building the
|
86
|
-
'sizes' attribute within your presets. Quotes are required around the media
|
87
|
-
queries, because yml gets confused by free colons.
|
39
|
+
These are named media queries for use in a few different places: specifying alternate source images
|
40
|
+
in your liquid tag, building the 'sizes' attribute within your presets, and in a few configuration
|
41
|
+
settings. Quotes are recommended around the media queries, because yml gets confused by colons.
|
88
42
|
|
89
43
|
## Markup Presets
|
90
44
|
|
@@ -93,15 +47,10 @@ queries, because yml gets confused by free colons.
|
|
93
47
|
```yml
|
94
48
|
markup_presets:
|
95
49
|
(name):
|
96
|
-
(option): (setting)
|
97
|
-
(option): (setting)
|
98
|
-
(option): (setting)
|
99
|
-
(...)
|
100
|
-
(another name):
|
101
|
-
(option): (setting)
|
102
50
|
(option): (setting)
|
103
51
|
(option): (setting)
|
104
52
|
(...)
|
53
|
+
(...)
|
105
54
|
```
|
106
55
|
|
107
56
|
*Example:*
|
@@ -119,35 +68,25 @@ markup_presets:
|
|
119
68
|
noscript: true
|
120
69
|
```
|
121
70
|
|
122
|
-
|
123
|
-
|
124
|
-
can select one as the first argument given to the tag:
|
71
|
+
Each entry is a pre-defined collection of settings to build a given chunk of text (usually HTML) and
|
72
|
+
its respective images. You can select one as the first argument given to the tag:
|
125
73
|
|
74
|
+
{% raw %}
|
126
75
|
`{% picture my-preset image.jpg %}`
|
76
|
+
{% endraw %}
|
127
77
|
|
128
|
-
The `default` preset will be used if none is specified. A preset name can't contain
|
129
|
-
or `/` characters.
|
130
|
-
|
131
|
-
#### A Note on srcsets, for the bad kids who didn't do the required reading.
|
132
|
-
|
133
|
-
There are 2 srcset formats, one based on providing widths, the other based on providing multipliers.
|
134
|
-
|
135
|
-
Width based srcsets look like this: `srcset="img.jpg 600w, img2.jpg 800w, img3.jpg 1000w"`. The
|
136
|
-
`(number)w` tells the browser how wide that image file is. Browsers are smart, they know their
|
137
|
-
device's pixel ratio, so in combination with the sizes attribute (if given, otherwise it assumes the
|
138
|
-
image will be 100vw) they can select the best-fitting image for the space it will fill on the screen. This is generally the one you want to use.
|
78
|
+
The `default` preset will be used if none is specified. A preset name can't contain a `.` (period).
|
139
79
|
|
140
|
-
|
141
|
-
browser is less smart here; it looks at its own device's pixel ratio, compares it to the given
|
142
|
-
multiplier, and picks the closest one. It doesn't consider anything else at all. Multiplier based
|
143
|
-
srcsets are best used when the image will always be the same size, on all screen sizes.
|
80
|
+
#### A Note on srcsets
|
144
81
|
|
145
|
-
|
146
|
-
|
82
|
+
For images that are different sizes on different screens (most images), use a width-based srcset
|
83
|
+
(which is the default). Specify a `widths` setting (or don't, for the default set), and optionally
|
84
|
+
the `sizes` and `size` settings.
|
147
85
|
|
148
|
-
|
86
|
+
Use a multiplier-based srcset when the image will always be the same size, regardless of screen
|
87
|
+
width (thumbnails and icons). To use a multiplier-based srcset, set `pixel_ratios` and `base_width`.
|
149
88
|
|
150
|
-
###
|
89
|
+
### Settings reference
|
151
90
|
|
152
91
|
* **Markup format**
|
153
92
|
|
@@ -155,20 +94,8 @@ To use a multiplier based srcset, set `pixel_ratios` and `base_width`.
|
|
155
94
|
|
156
95
|
*Default*: `auto`
|
157
96
|
|
158
|
-
Defines what format the generated
|
159
|
-
|
160
|
-
* `picture`: `<picture>` element surrounding a `<source>` tag for each required srcset, and a
|
161
|
-
fallback `<img>`.
|
162
|
-
* `img`: output a single `<img>` tag with a `srcset` entry.
|
163
|
-
* `auto`: Supply an img tag when you have only one srcset, otherwise supply a picture tag.
|
164
|
-
* `data_picture`, `data_img`, `data_auto`: Analogous to their counterparts,
|
165
|
-
but instead of `src`, `srcset`, and `sizes`, you get `data-src`, `data-srcset`, and
|
166
|
-
`data-sizes`. This allows you to use javascript for things like [lazy loading](https://github.com/verlok/lazyload)
|
167
|
-
* `direct_url`: Generates an image and returns only its url. Uses `fallback_` properties (width
|
168
|
-
and format)
|
169
|
-
* `naked_srcset`: Builds a srcset and nothing else (not even the surrounding quotes). Useful with
|
170
|
-
libraries requiring more complex or customized markup. Note that the (image) `format` setting
|
171
|
-
must still be an array, even if you can only give it one value.
|
97
|
+
Defines what format the generated text will take. They are documented [here]({{ site.baseurl }}/output).
|
98
|
+
|
172
99
|
|
173
100
|
* **Image Formats**
|
174
101
|
|
@@ -178,22 +105,16 @@ To use a multiplier based srcset, set `pixel_ratios` and `base_width`.
|
|
178
105
|
|
179
106
|
*Default*: `original`
|
180
107
|
|
181
|
-
*Supported formats are anything which imagemagick supports, including the
|
182
|
-
following:*
|
183
|
-
* jpg/jpeg
|
184
|
-
* png
|
185
|
-
* gif
|
186
|
-
* webp
|
187
|
-
* jxr
|
188
|
-
* jp2
|
189
|
-
|
190
108
|
Array (yml sequence) of the image formats you'd like to generate, in decreasing order of
|
191
109
|
preference. Browsers will render the first format they find and understand, so **If you put jpg
|
192
110
|
before webp, your webp images will never be used**. `original` does what you'd expect. To supply
|
193
111
|
webp, you must have an imagemagick webp delegate installed. (Most package managers just name it
|
194
112
|
'webp')
|
195
113
|
|
196
|
-
*
|
114
|
+
*Supported formats are anything which imagemagick supports, and has an installed delegate. See a
|
115
|
+
list by running `$ convert --version`*
|
116
|
+
|
117
|
+
* **Widths**
|
197
118
|
|
198
119
|
*Format:* `widths: [integer, integer, (...)]`
|
199
120
|
|
@@ -201,24 +122,24 @@ To use a multiplier based srcset, set `pixel_ratios` and `base_width`.
|
|
201
122
|
|
202
123
|
*Default*: `[400, 600, 800, 1000]`
|
203
124
|
|
204
|
-
Array of image widths to generate, in pixels. For use when you want a
|
125
|
+
Array of image widths to generate, in pixels. For use when you want a width-based srcset
|
205
126
|
(`srcset="img.jpg 800w, img2.jpg 1600w"`).
|
206
127
|
|
207
|
-
* **
|
128
|
+
* **Media_widths**
|
208
129
|
|
209
130
|
*Format:*
|
210
131
|
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
132
|
+
```yml
|
133
|
+
media_widths:
|
134
|
+
(media preset name): [integer, integer, (...)]
|
135
|
+
```
|
215
136
|
|
216
137
|
*Example:*
|
217
138
|
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
139
|
+
```yml
|
140
|
+
media_widths:
|
141
|
+
mobile: [400, 600, 800]
|
142
|
+
```
|
222
143
|
|
223
144
|
*Default:* Widths setting
|
224
145
|
|
@@ -226,48 +147,28 @@ To use a multiplier based srcset, set `pixel_ratios` and `base_width`.
|
|
226
147
|
image. You can specify sets of widths to associate with given media queries. If not specified,
|
227
148
|
will use `widths` setting.
|
228
149
|
|
229
|
-
* **Fallback Width**
|
230
|
-
|
231
|
-
*Format:* `fallback_width: (integer)`
|
232
|
-
|
233
|
-
*Example:* `fallback_width: 800`
|
234
|
-
|
235
|
-
*Default*: `800`
|
236
|
-
|
237
|
-
Width of the fallback image.
|
238
|
-
|
239
|
-
* **Fallback Image**
|
240
|
-
|
241
|
-
*Format:* `fallback_format: (format)`
|
242
|
-
|
243
|
-
*Example:* `fallback_format: jpg`
|
244
|
-
|
245
|
-
*Default*: `original`
|
246
|
-
|
247
|
-
Format of the fallback image
|
248
|
-
|
249
150
|
* **Sizes**
|
250
151
|
|
251
152
|
*Format:*
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
```
|
153
|
+
|
154
|
+
```yml
|
155
|
+
sizes:
|
156
|
+
(media preset): (CSS dimension)
|
157
|
+
(...)
|
158
|
+
```
|
259
159
|
|
260
160
|
*Example:*
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
161
|
+
|
162
|
+
```yml
|
163
|
+
sizes:
|
164
|
+
mobile: 80vw
|
165
|
+
tablet: 60vw
|
166
|
+
desktop: 900px
|
167
|
+
```
|
267
168
|
|
268
169
|
Conditional sizes, used to construct the `sizes=` HTML attribute telling the browser how wide your
|
269
170
|
image will be (on the screen) when a given media query is true. CSS dimensions can be given in
|
270
|
-
`px`, `em`, or `vw`. To be used along with a width
|
171
|
+
`px`, `em`, or `vw`. To be used along with a width-based srcset.
|
271
172
|
|
272
173
|
Provide these in order of most restrictive to least restrictive. The browser will choose the
|
273
174
|
first one with an applicable media query.
|
@@ -275,18 +176,13 @@ To use a multiplier based srcset, set `pixel_ratios` and `base_width`.
|
|
275
176
|
You don't have to provide a sizes attribute at all. If you don't, the browser will assume the
|
276
177
|
image is 100% the width of the viewport.
|
277
178
|
|
278
|
-
The same sizes attribute is used for every source tag in a given picture tag. This causes some
|
279
|
-
redundant markup, specifying sizes for situations when an image will never be rendered, but it
|
280
|
-
keeps things a bit simpler.
|
281
|
-
|
282
179
|
* **Size**
|
283
180
|
|
284
181
|
*Format:* `size: (CSS Dimension)`
|
285
182
|
|
286
183
|
*Example:* `size: 80vw`
|
287
184
|
|
288
|
-
Unconditional
|
289
|
-
either alone or after all conditional sizes.
|
185
|
+
Unconditional `sizes` setting, to be supplied either alone or after all conditional sizes.
|
290
186
|
|
291
187
|
* **Pixel Ratios**
|
292
188
|
|
@@ -309,7 +205,7 @@ To use a multiplier based srcset, set `pixel_ratios` and `base_width`.
|
|
309
205
|
|
310
206
|
* **Quality**
|
311
207
|
|
312
|
-
*Format:* `quality: integer <= 100`
|
208
|
+
*Format:* `quality: 0 <= integer <= 100`
|
313
209
|
|
314
210
|
*Example:* `quality: 80`
|
315
211
|
|
@@ -324,9 +220,7 @@ To use a multiplier based srcset, set `pixel_ratios` and `base_width`.
|
|
324
220
|
|
325
221
|
```yml
|
326
222
|
format_quality:
|
327
|
-
(format): integer <= 100
|
328
|
-
(format): integer <= 100
|
329
|
-
(format): integer <= 100
|
223
|
+
(format): 0 <= integer <= 100
|
330
224
|
(...)
|
331
225
|
```
|
332
226
|
|
@@ -352,8 +246,6 @@ To use a multiplier based srcset, set `pixel_ratios` and `base_width`.
|
|
352
246
|
|
353
247
|
```yml
|
354
248
|
attributes:
|
355
|
-
(element): '(attributes)'
|
356
|
-
(element): '(attributes)'
|
357
249
|
(element): '(attributes)'
|
358
250
|
(...)
|
359
251
|
```
|
@@ -367,22 +259,30 @@ To use a multiplier based srcset, set `pixel_ratios` and `base_width`.
|
|
367
259
|
```
|
368
260
|
|
369
261
|
HTML attributes you would like to add. The same arguments are available here as in the liquid
|
370
|
-
tag
|
371
|
-
yml, so it's recommended to surround them with single quotes.
|
262
|
+
tag: HTML element names, `alt:`, `link:`, and `parent:`. Unescaped double quotes cause problems
|
263
|
+
with yml, so it's recommended to surround them with single quotes.
|
372
264
|
|
373
|
-
* **
|
265
|
+
* **Fallback Width**
|
374
266
|
|
375
|
-
*Format:* `
|
267
|
+
*Format:* `fallback_width: (integer)`
|
376
268
|
|
377
|
-
*Example:* `
|
269
|
+
*Example:* `fallback_width: 800`
|
378
270
|
|
379
|
-
*Default
|
271
|
+
*Default*: `800`
|
380
272
|
|
381
|
-
|
382
|
-
`<noscript>` tag after the standard html. This allows you to use lazy loading or other javascript
|
383
|
-
image tools, without breaking all of your images for non-javascript-enabled users.
|
273
|
+
Width of the fallback image.
|
384
274
|
|
385
|
-
* **
|
275
|
+
* **Fallback Format**
|
276
|
+
|
277
|
+
*Format:* `fallback_format: (format)`
|
278
|
+
|
279
|
+
*Example:* `fallback_format: jpg`
|
280
|
+
|
281
|
+
*Default*: `original`
|
282
|
+
|
283
|
+
Format of the fallback image
|
284
|
+
|
285
|
+
* **Source Image Link**
|
386
286
|
|
387
287
|
*Format:* `link_source: (true|false)`
|
388
288
|
|
@@ -392,7 +292,7 @@ To use a multiplier based srcset, set `pixel_ratios` and `base_width`.
|
|
392
292
|
|
393
293
|
Surround image with a link to the original source file. Your source image directory must be
|
394
294
|
published as part of the compiled site. If you run into weird issues with the output, see
|
395
|
-
[notes](notes
|
295
|
+
the [notes]({{ site.baseurl }}/notes).
|
396
296
|
|
397
297
|
* **Nomarkdown override**
|
398
298
|
|
@@ -403,5 +303,4 @@ To use a multiplier based srcset, set `pixel_ratios` and `base_width`.
|
|
403
303
|
*Default:* `nil`
|
404
304
|
|
405
305
|
Hard setting for `{::nomarkdown}` tags, overrides both autodetection and the global setting in
|
406
|
-
`_config.yml`. See [notes](notes
|
407
|
-
|
306
|
+
`_config.yml`. See the [notes]({{ site.baseurl }}/notes) for a detailed explanation.
|
data/docs/releases.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
---
|
2
|
+
---
|
3
|
+
# Release History
|
4
|
+
|
5
|
+
* 1.7.1 Nov 14, 2019
|
6
|
+
* Fix some HTML attribute related bugs
|
7
|
+
* Add a few items to the FAQ
|
8
|
+
* 1.7.0 Aug 12, 2019
|
9
|
+
* Add support for setting generated image quality, either generally or specific to given
|
10
|
+
formats.
|
11
|
+
* Add support for spaces and other url-encoded characters in filenames
|
12
|
+
* Documentation restructure - Moved it out of the wiki, into the `docs` folder.
|
13
|
+
* Bugfix: Fallback image width will now be checked against source image width.
|
14
|
+
* Bugfix: Minor fix to nomarkdown wrapper output
|
15
|
+
* link_source will now target the base source image, rather than finding the biggest one.
|
16
|
+
* Remove fastimage dependency, add addressable dependency.
|
17
|
+
* Moderately significant refactoring and code cleanup
|
18
|
+
* Decent set of tests added
|
19
|
+
* 1.6.0 Jul 2, 2019:
|
20
|
+
* Missing Preset warning respects `data_dir` setting
|
21
|
+
* Add `continue_on_missing` option
|
22
|
+
* 1.5.0 Jun 26, 2019:
|
23
|
+
* better `{::nomarkdown}` necessity detection
|
24
|
+
* allow user to override `{::nomarkdown}` autodetection
|
25
|
+
* 1.4.0 Jun 26, 2019:
|
26
|
+
* Rename gem from `jekyll-picture-tag` to `jekyll_picture_tag`, allowing us to use rubygems again.
|
27
|
+
* Add new output format: `naked_srcset`.
|
28
|
+
* 1.3.1 Jun 21, 2019: Bugfix
|
29
|
+
* 1.3.0 Jun 7, 2019:
|
30
|
+
* Initial compatibility with Jekyll 4.0
|
31
|
+
* bugfixes
|
32
|
+
* change to generated image naming-- The first build after this update will be longer, and you
|
33
|
+
might want to clear out your generated images.
|
34
|
+
* 1.2.0 Feb 9, 2019:
|
35
|
+
* Add nomarkdown fix
|
36
|
+
* noscript option
|
37
|
+
* relative url option
|
38
|
+
* anchor tag wrappers
|
39
|
+
* 1.1.0 Jan 22, 2019:
|
40
|
+
* Add direct_url markup format,
|
41
|
+
* auto-orient images before stripping metadata
|
42
|
+
* 1.0.2 Jan 18, 2019: Fix ruby version specification
|
43
|
+
* 1.0.1 Jan 13, 2019: Added ruby version checking
|
44
|
+
* **1.0.0** Nov 27, 2018: Rewrite from the ground up. See the [migration guide]({{ site.baseurl }}/migration).
|
45
|
+
* 0.2.2 Aug 2, 2013: Bugfixes
|
46
|
+
* 0.2.1 Jul 17, 2013: Refactor again, add Liquid parsing.
|
47
|
+
* 0.2.0 Jul 14, 2013: Rewrite code base, bring in line with Jekyll Image Tag.
|
48
|
+
* 0.1.1 Jul 5, 2013: Quick round of code improvements.
|
49
|
+
* 0.1.0 Jul 5, 2013: Initial release.
|