jekyll_picture_tag 1.11.0 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/docs/Gemfile +4 -2
  3. data/docs/Gemfile.lock +14 -12
  4. data/docs/_config.yml +6 -10
  5. data/docs/devs/contributing/code.md +44 -0
  6. data/docs/devs/contributing/docs.md +13 -0
  7. data/docs/devs/contributing/index.md +15 -0
  8. data/docs/devs/contributing/setup.md +13 -0
  9. data/docs/devs/contributing/testing.md +41 -0
  10. data/docs/devs/index.md +7 -0
  11. data/docs/{releases.md → devs/releases.md} +24 -14
  12. data/docs/index.md +43 -27
  13. data/docs/users/configuration/cdn.md +35 -0
  14. data/docs/users/configuration/directories.md +34 -0
  15. data/docs/users/configuration/disable.md +24 -0
  16. data/docs/users/configuration/fast_build.md +28 -0
  17. data/docs/users/configuration/ignore_missing.md +23 -0
  18. data/docs/users/configuration/index.md +29 -0
  19. data/docs/users/configuration/kramdown_fix.md +20 -0
  20. data/docs/users/configuration/relative_urls.md +15 -0
  21. data/docs/users/configuration/suppress_warnings.md +16 -0
  22. data/docs/users/index.md +7 -0
  23. data/docs/users/installation.md +52 -0
  24. data/docs/users/liquid_tag/argument_reference/alternate_images.md +18 -0
  25. data/docs/users/liquid_tag/argument_reference/attributes.md +42 -0
  26. data/docs/users/liquid_tag/argument_reference/base_image.md +12 -0
  27. data/docs/users/liquid_tag/argument_reference/crop.md +48 -0
  28. data/docs/users/liquid_tag/argument_reference/link.md +16 -0
  29. data/docs/users/liquid_tag/argument_reference/preset.md +17 -0
  30. data/docs/users/liquid_tag/argument_reference/readme.md +9 -0
  31. data/docs/users/liquid_tag/examples.md +81 -0
  32. data/docs/users/liquid_tag/index.md +31 -0
  33. data/docs/users/notes/git_lfs.md +7 -0
  34. data/docs/users/notes/github_pages.md +5 -0
  35. data/docs/users/notes/html_attributes.md +5 -0
  36. data/docs/users/notes/index.md +6 -0
  37. data/docs/users/notes/input_checking.md +6 -0
  38. data/docs/users/notes/kramdown_bug.md +41 -0
  39. data/docs/users/notes/managing_images.md +21 -0
  40. data/docs/{migration.md → users/notes/migration.md} +0 -0
  41. data/docs/users/presets/cropping.md +61 -0
  42. data/docs/users/presets/default.md +23 -0
  43. data/docs/users/presets/examples.md +79 -0
  44. data/docs/users/presets/fallback_image.md +28 -0
  45. data/docs/users/presets/html_attributes.md +26 -0
  46. data/docs/users/presets/image_formats.md +21 -0
  47. data/docs/users/presets/image_quality.md +43 -0
  48. data/docs/users/presets/index.md +101 -0
  49. data/docs/users/presets/link_source.md +16 -0
  50. data/docs/users/presets/markup_formats/fragments.md +48 -0
  51. data/docs/users/presets/markup_formats/javascript_friendly.md +57 -0
  52. data/docs/users/presets/markup_formats/readme.md +43 -0
  53. data/docs/users/presets/markup_formats/standard_html.md +25 -0
  54. data/docs/users/presets/media_queries.md +36 -0
  55. data/docs/users/presets/nomarkdown_override.md +17 -0
  56. data/docs/users/presets/pixel_ratio_srcsets.md +32 -0
  57. data/docs/users/presets/width_height_attributes.md +34 -0
  58. data/docs/users/presets/width_srcsets.md +85 -0
  59. data/lib/jekyll_picture_tag/instructions/preset.rb +5 -1
  60. data/lib/jekyll_picture_tag/instructions/set.rb +5 -1
  61. data/lib/jekyll_picture_tag/version.rb +1 -1
  62. metadata +55 -14
  63. data/docs/_layouts/directory.html +0 -32
  64. data/docs/assets/style.css +0 -31
  65. data/docs/contributing.md +0 -109
  66. data/docs/example_presets.md +0 -116
  67. data/docs/global_configuration.md +0 -173
  68. data/docs/installation.md +0 -45
  69. data/docs/notes.md +0 -91
  70. data/docs/output.md +0 -63
  71. data/docs/presets.md +0 -391
  72. data/docs/usage.md +0 -157
@@ -0,0 +1,21 @@
1
+ ---
2
+ sort: 2
3
+ ---
4
+
5
+ # Image Formats
6
+
7
+ _Format:_ `format: [format1, format2, (...)]`
8
+
9
+ _Example:_ `format: [webp, original]`
10
+
11
+ _Default_: `original`
12
+
13
+ Array (yml sequence) of the image formats you'd like to generate, in decreasing
14
+ order of preference. Browsers will render the first format they find and
15
+ understand, so **If you put jpg before webp, your webp images will never be
16
+ used**. `original` does what you'd expect. To supply webp, you must have an
17
+ imagemagick webp delegate installed. (Most package managers just name it 'webp')
18
+
19
+ _Supported formats are anything which imagemagick supports, and has an installed
20
+ delegate. See a list by running `$ convert --version`_.
21
+
@@ -0,0 +1,43 @@
1
+ ---
2
+ sort: 6
3
+ ---
4
+
5
+ # Image Quality
6
+
7
+ ## Quality
8
+
9
+ _Format:_ `quality: 0 <= integer <= 100`
10
+
11
+ _Example:_ `quality: 80`
12
+
13
+ _Default:_ `75`
14
+
15
+ Specify an image compression level for all image formats (where it makes
16
+ sense, anyway).
17
+
18
+ ## Format Quality
19
+
20
+ _Format:_
21
+
22
+ ```yaml
23
+ format_quality:
24
+ (format): 0 <= integer <= 100
25
+ (...)
26
+ ```
27
+
28
+ _Example:_
29
+
30
+ ```yaml
31
+ format_quality:
32
+ jpg: 75
33
+ png: 65
34
+ webp: 55
35
+ ```
36
+
37
+ _Default:_ quality setting
38
+
39
+ Specify quality settings for various image formats, allowing you to take
40
+ advantage of webp's better compression algorithm without trashing your jpg
41
+ images (for example). If you don't give a setting for a particular format
42
+ it'll fall back to the `quality` setting above, and if you don't set _that_
43
+ it'll default to 75.
@@ -0,0 +1,101 @@
1
+ ---
2
+ sort: 3
3
+ ---
4
+
5
+ # Writing Presets
6
+
7
+ Presets are named collections of settings that determine basically everything
8
+ about JPT's output. Think of them like frameworks that you can plug images into;
9
+ the preset determines what markup, what image sizes, and what image formats to
10
+ create, while the picture tag determines which image(s) will be used. They are
11
+ stored in `_data/picture.yml`. You will have to create this file, and probably
12
+ the `_data/` directory as well.
13
+
14
+ Any settings which are specific to particular markup formats are documented on
15
+ their respective markup format page.
16
+
17
+ ## Required Knowledge
18
+
19
+ If you don't know the difference between resolution switching and art direction,
20
+ stop now and learn responsive images. Ideally, write a few yourself until you
21
+ understand them.
22
+
23
+ Here are some good guides:
24
+
25
+ * [MDN Responsive Images guide](https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images)
26
+ * [CSS Tricks Guide to Reponsive Images](https://css-tricks.com/a-guide-to-the-responsive-images-syntax-in-html/)
27
+ * [Cloud 4 - Responsive Images 101](https://cloudfour.com/thinks/responsive-images-101-definitions/)
28
+
29
+ ## Media Queries
30
+
31
+ **Media queries are not presets**, but they are used when writing them. They are
32
+ defined in `_data/picture.yml` alongside presets. More information
33
+ [here](media_queries).
34
+
35
+ ## Presets
36
+
37
+ _General Format:_
38
+
39
+ ```yaml
40
+ # _data/picture.yml
41
+
42
+ presets:
43
+ (name):
44
+ (option): (setting)
45
+ (option): (setting)
46
+ (...)
47
+ (...)
48
+ ```
49
+
50
+ _Example:_
51
+
52
+ ```yaml
53
+ # _data/picture.yml
54
+
55
+ presets:
56
+ default:
57
+ formats: [webp, original]
58
+ widths: [200, 400, 800, 1600]
59
+ link_source: true
60
+
61
+ lazy:
62
+ markup: data_auto
63
+ widths: [200, 400, 800, 1600]
64
+ link_source: true
65
+ noscript: true
66
+ ```
67
+
68
+ Each entry is a pre-defined collection of settings to build a given chunk of
69
+ text (usually HTML) and its respective images. You can select one as the first
70
+ argument given to the tag:
71
+
72
+ {% raw %}
73
+ `{% picture my-preset image.jpg %}`
74
+ {% endraw %}
75
+
76
+ The `default` preset will be used if none is specified. A preset name can't
77
+ contain a `.` (period). You can create as many as you like.
78
+
79
+ ```note
80
+ `media_queries` and `presets` used to be called `media_presets` and
81
+ `markup_presets`. These names were causing some confusion, so they were
82
+ changed. The old names will continue working for the forseeable future, at least
83
+ until the next major version update.
84
+ ```
85
+
86
+ ## Markup Format
87
+
88
+ The high level, overall markup format is controlled with the `markup:` setting,
89
+ documented [here](markup_formats).
90
+
91
+ ## Choosing a Srcset format
92
+
93
+ For images that are different sizes on different screens (most images), use a
94
+ [width-based srcset](width_srcsets) (which is the default).
95
+
96
+ Use a [pixel-ratio srcset](pixel_ratio_srcsets) when the image will always be
97
+ the same size, regardless of screen width (thumbnails and icons).
98
+
99
+ ## Settings reference
100
+
101
+ {% include list.liquid %}
@@ -0,0 +1,16 @@
1
+ ---
2
+ sort: 10
3
+ ---
4
+
5
+ # Source Image Link
6
+
7
+ _Format:_ `link_source: (true|false)`
8
+
9
+ _Example:_ `link_source: true`
10
+
11
+ _Default:_ `false`
12
+
13
+ Surround image with a link to the original source file. Your source image
14
+ directory must be published as part of the compiled site. If you run into weird
15
+ issues with the output, see the [notes]({{ site.baseurl }}/notes).
16
+
@@ -0,0 +1,48 @@
1
+ ---
2
+ sort: 3
3
+ ---
4
+
5
+ # Fragments
6
+
7
+ The following are not complete markup; they're building blocks that you can use
8
+ to make things outside the scope of JPT.
9
+
10
+ - `direct_url` Generates an image and returns only its url. Uses
11
+ `fallback_width` and `fallback_format`.
12
+
13
+ ```yml
14
+ # _data/picture.yml
15
+
16
+ markup_presets:
17
+ direct:
18
+ markup: direct_url
19
+ fallback_width: 800
20
+ fallback_format: webp
21
+ ```
22
+
23
+ ```
24
+ {% raw %}
25
+ {% picture direct myimage.jpg %} --> /generated/myimage-800-abcd12345.webp
26
+ {% endraw %}
27
+ ```
28
+
29
+ - `naked_srcset`: Builds a srcset and nothing else (not even the surrounding quotes). Note that the
30
+ (image) `format` setting must still be an array, even if you only give it one
31
+ value. (This is on the list of things to improve.)
32
+
33
+ ```yml
34
+ # _data/picture.yml
35
+
36
+ markup_presets:
37
+ only_srcset:
38
+ markup: naked_srcset
39
+ widths: [800, 1200, 1600]
40
+ format: [webp]
41
+ ```
42
+
43
+ ```
44
+ {% raw %}
45
+ {% picture only_srcset myimage.jpg %} -->
46
+ /generated/myimage-800-abcd12345.webp 800w, /generated/myimage-1200-abcd12345.webp 1200w, (...)
47
+ {% endraw %}
48
+ ```
@@ -0,0 +1,57 @@
1
+ ---
2
+ sort: 2
3
+ ---
4
+
5
+ # Javascript Friendly
6
+
7
+ These are analogous to their plain HTML counterparts, but instead of `src`,
8
+ `srcset`, and `sizes`, you get `data-src`, `data-srcset`, and `data-sizes`. This
9
+ allows you to use javascript for things like [lazy
10
+ loading](https://github.com/verlok/lazyload).
11
+
12
+ - `data_picture`
13
+
14
+ ```html
15
+ <picture>
16
+ <source data-srcset="..." data-sizes="...">
17
+ <source data-srcset="..." data-sizes="...">
18
+ (...)
19
+ <img data-src="...">
20
+ </picture>
21
+ ```
22
+
23
+ - `data_img`
24
+ ```html
25
+ <img data-srcset="..." data-src="..." data-sizes="...">
26
+ ```
27
+
28
+ - `data_auto` - `data_picture` when needed, otherwise `data_img`.
29
+
30
+ ## Special Options
31
+
32
+ The following preset settings only apply to these output formats.
33
+
34
+ - `noscript`
35
+
36
+ _Format:_ `noscript: true|false`
37
+
38
+ _Default:_ `false`
39
+
40
+ Include a basic `img` fallback within a `<noscript>` tag, giving your
41
+ non-javascript-running users something to look at.
42
+
43
+ ```html
44
+ <img data-srcset="..." data-src="..." data-sizes="...">
45
+ <noscript>
46
+ <img src="..." alt="...">
47
+ </noscript>
48
+ ```
49
+
50
+ - `data_sizes`
51
+
52
+ _Format:_ `data_sizes: true|false`
53
+
54
+ _Default:_ `true`
55
+
56
+ This option sets whether you would like JPT's auto-generated sizes to be returned as a
57
+ `data-sizes` attribute or a normal `sizes` attribute.
@@ -0,0 +1,43 @@
1
+ ---
2
+ sort: 1
3
+ ---
4
+
5
+ # Markup Formats
6
+
7
+ Define what format the generated text will take. Select one by setting
8
+ `markup:` in the relevant [preset]({{ site.baseurl }}/users/presets).
9
+
10
+ _Format:_ `markup: (setting)`
11
+
12
+ _Default_: `auto`
13
+
14
+
15
+ Example:
16
+
17
+ ```yml
18
+ # /_data/picture.yml
19
+
20
+ markup_presets:
21
+ my_preset:
22
+ markup: data_auto
23
+ ```
24
+
25
+ ## Valid options:
26
+
27
+ ### Standard HTML:
28
+ - `auto` - default
29
+ - `picture`
30
+ - `img`
31
+
32
+ ### Javascript Friendly:
33
+ - `data_auto`
34
+ - `data_picture`
35
+ - `data_img`
36
+
37
+ ### Fragments:
38
+ - `direct_url`
39
+ - `naked_srcset`
40
+
41
+ ## Reference:
42
+
43
+ {% include list.liquid %}
@@ -0,0 +1,25 @@
1
+ ---
2
+ sort: 1
3
+ ---
4
+
5
+ # Standard HTML
6
+
7
+ - **`picture`** - `<picture>` element surrounding a `<source>` tag for each required srcset, and a
8
+ fallback `<img>`:
9
+
10
+ ```html
11
+ <picture>
12
+ <source srcset="..." sizes="..." media="..." type="...">
13
+ <source srcset="..." sizes="..." media="..." type="...">
14
+ (...)
15
+ <img src="...">
16
+ </picture
17
+ ```
18
+
19
+ - **`img`** - a single `<img>` tag with a `srcset` entry:
20
+
21
+ ```html
22
+ <img src="..." srcset="..." sizes="..." alt="..." width="..." height="...">
23
+ ```
24
+
25
+ - **`auto`** - Supply an img tag when you have only one srcset, otherwise supply a picture tag.
@@ -0,0 +1,36 @@
1
+ ---
2
+ sort: 1
3
+ ---
4
+
5
+ # Media Queries
6
+
7
+ Jekyll Picture Tag handles media queries by letting you define them by name in
8
+ `_data/picture.yml`, and then referencing that name whenever you need it.
9
+
10
+ _Format:_
11
+
12
+ ```yaml
13
+ # _data/picture.yml
14
+
15
+ media_queries:
16
+ (name): (css media query)
17
+ (name): (css media query)
18
+ (...)
19
+
20
+ ```
21
+
22
+ _Example:_
23
+
24
+ ```yaml
25
+ # _data/picture.yml
26
+
27
+ media_queries:
28
+ mobile: "max-width: 600px"
29
+ tablet: "max-width: 800px"
30
+ ultrawide: "min-width: 1400px"
31
+ ```
32
+
33
+ They are used in a few different places: specifying alternate source images in
34
+ your liquid tag, building the 'sizes' attribute within your presets, and in a
35
+ few configuration settings. Quotes are recommended, because yml gets confused by
36
+ colons.
@@ -0,0 +1,17 @@
1
+ ---
2
+ sort: 11
3
+ ---
4
+
5
+ # Nomarkdown Override
6
+
7
+ _Format:_ `nomarkdown: (true|false)`
8
+
9
+ _Example:_ `nomarkdown: false`
10
+
11
+ _Default:_ `nil`
12
+
13
+ Hard setting for `{::nomarkdown}` tags, overrides both autodetection and the
14
+ global setting in `_config.yml`.
15
+
16
+ See this [note]({{ site.baseurl }}/users/notes/kramdown_bug) for a detailed
17
+ explanation.
@@ -0,0 +1,32 @@
1
+ ---
2
+ sort: 4
3
+ ---
4
+
5
+ # Pixel Ratio Srcsets
6
+
7
+ A Pixel Ratio srcset looks like this:
8
+
9
+ ```html
10
+ srcset="myimage-200.jpg 1.0x, myimage-300.jpg 1.5x, myimage-400.jpg 2.0x"
11
+ ```
12
+
13
+ To use one, set `pixel_ratios` and `base_width`. They are most appropriate for
14
+ thumbnails and icons, where the image will be the same size on all screens, and
15
+ all you need to account for is pixel ratio.
16
+
17
+ ## Base Width
18
+
19
+ _Format:_ `base_width: integer`
20
+
21
+ _Example:_ `base_width: 100`
22
+
23
+ Sets how wide the 1x image should be. Required when using a Pixel Ratio srcset.
24
+
25
+ ## Pixel Ratios
26
+
27
+ _Format:_ `pixel_ratios: [number, number, number (...)]`
28
+
29
+ _Example:_ `pixel_ratios: [1, 1.5, 2]`
30
+
31
+ Array of images to construct, given in multiples of the base width.
32
+