jekyll_picture_tag 1.10.0 → 1.13.0

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.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +79 -0
  3. data/docs/Gemfile +4 -2
  4. data/docs/Gemfile.lock +14 -12
  5. data/docs/_config.yml +6 -10
  6. data/docs/devs/contributing/code.md +44 -0
  7. data/docs/devs/contributing/docs.md +13 -0
  8. data/docs/devs/contributing/index.md +15 -0
  9. data/docs/devs/contributing/setup.md +13 -0
  10. data/docs/devs/contributing/testing.md +41 -0
  11. data/docs/devs/index.md +7 -0
  12. data/docs/{releases.md → devs/releases.md} +37 -13
  13. data/docs/index.md +42 -26
  14. data/docs/users/configuration/cdn.md +35 -0
  15. data/docs/users/configuration/directories.md +34 -0
  16. data/docs/users/configuration/disable.md +24 -0
  17. data/docs/users/configuration/fast_build.md +28 -0
  18. data/docs/users/configuration/ignore_missing.md +23 -0
  19. data/docs/users/configuration/index.md +29 -0
  20. data/docs/users/configuration/kramdown_fix.md +20 -0
  21. data/docs/users/configuration/relative_urls.md +15 -0
  22. data/docs/users/configuration/suppress_warnings.md +16 -0
  23. data/docs/users/index.md +7 -0
  24. data/docs/users/installation.md +52 -0
  25. data/docs/users/liquid_tag/argument_reference/alternate_images.md +18 -0
  26. data/docs/users/liquid_tag/argument_reference/attributes.md +42 -0
  27. data/docs/users/liquid_tag/argument_reference/base_image.md +12 -0
  28. data/docs/users/liquid_tag/argument_reference/crop.md +48 -0
  29. data/docs/users/liquid_tag/argument_reference/link.md +16 -0
  30. data/docs/users/liquid_tag/argument_reference/preset.md +17 -0
  31. data/docs/users/liquid_tag/argument_reference/readme.md +9 -0
  32. data/docs/users/liquid_tag/examples.md +93 -0
  33. data/docs/users/liquid_tag/index.md +31 -0
  34. data/docs/users/notes/git_lfs.md +7 -0
  35. data/docs/users/notes/github_pages.md +5 -0
  36. data/docs/users/notes/html_attributes.md +5 -0
  37. data/docs/users/notes/index.md +6 -0
  38. data/docs/users/notes/input_checking.md +6 -0
  39. data/docs/users/notes/kramdown_bug.md +41 -0
  40. data/docs/users/notes/managing_images.md +21 -0
  41. data/docs/{migration.md → users/notes/migration.md} +0 -0
  42. data/docs/users/presets/cropping.md +61 -0
  43. data/docs/users/presets/default.md +23 -0
  44. data/docs/users/presets/examples.md +79 -0
  45. data/docs/users/presets/fallback_image.md +28 -0
  46. data/docs/users/presets/html_attributes.md +26 -0
  47. data/docs/users/presets/image_formats.md +21 -0
  48. data/docs/users/presets/image_quality.md +105 -0
  49. data/docs/users/presets/index.md +101 -0
  50. data/docs/users/presets/link_source.md +16 -0
  51. data/docs/users/presets/markup_formats/fragments.md +48 -0
  52. data/docs/users/presets/markup_formats/javascript_friendly.md +57 -0
  53. data/docs/users/presets/markup_formats/readme.md +43 -0
  54. data/docs/users/presets/markup_formats/standard_html.md +25 -0
  55. data/docs/users/presets/media_queries.md +36 -0
  56. data/docs/users/presets/nomarkdown_override.md +17 -0
  57. data/docs/users/presets/pixel_ratio_srcsets.md +32 -0
  58. data/docs/users/presets/quality_width_graph.png +0 -0
  59. data/docs/users/presets/width_height_attributes.md +34 -0
  60. data/docs/users/presets/width_srcsets.md +85 -0
  61. data/jekyll_picture_tag.gemspec +4 -5
  62. data/lib/jekyll_picture_tag.rb +3 -4
  63. data/lib/jekyll_picture_tag/cache.rb +3 -0
  64. data/lib/jekyll_picture_tag/cache/base.rb +59 -0
  65. data/lib/jekyll_picture_tag/cache/generated.rb +20 -0
  66. data/lib/jekyll_picture_tag/cache/source.rb +19 -0
  67. data/lib/jekyll_picture_tag/defaults/presets.yml +1 -0
  68. data/lib/jekyll_picture_tag/images.rb +3 -0
  69. data/lib/jekyll_picture_tag/images/generated_image.rb +127 -0
  70. data/lib/jekyll_picture_tag/{img_uri.rb → images/img_uri.rb} +1 -0
  71. data/lib/jekyll_picture_tag/images/source_image.rb +103 -0
  72. data/lib/jekyll_picture_tag/instructions/arg_splitter.rb +3 -2
  73. data/lib/jekyll_picture_tag/instructions/configuration.rb +1 -1
  74. data/lib/jekyll_picture_tag/instructions/preset.rb +24 -4
  75. data/lib/jekyll_picture_tag/instructions/set.rb +5 -1
  76. data/lib/jekyll_picture_tag/output_formats/basic.rb +16 -14
  77. data/lib/jekyll_picture_tag/output_formats/img.rb +11 -0
  78. data/lib/jekyll_picture_tag/output_formats/picture.rb +22 -0
  79. data/lib/jekyll_picture_tag/router.rb +3 -2
  80. data/lib/jekyll_picture_tag/srcsets/basic.rb +10 -1
  81. data/lib/jekyll_picture_tag/utils.rb +14 -0
  82. data/lib/jekyll_picture_tag/version.rb +1 -1
  83. data/readme.md +9 -7
  84. metadata +78 -45
  85. data/docs/_layouts/directory.html +0 -32
  86. data/docs/assets/style.css +0 -31
  87. data/docs/contributing.md +0 -109
  88. data/docs/example_presets.md +0 -116
  89. data/docs/global_configuration.md +0 -173
  90. data/docs/installation.md +0 -45
  91. data/docs/notes.md +0 -91
  92. data/docs/output.md +0 -63
  93. data/docs/presets.md +0 -361
  94. data/docs/usage.md +0 -143
  95. data/lib/jekyll_picture_tag/generated_image.rb +0 -161
  96. data/lib/jekyll_picture_tag/source_image.rb +0 -87
@@ -1,116 +0,0 @@
1
- ---
2
- ---
3
- # /_data/picture.yml
4
-
5
- These are example settings- I mostly made them up off the top of my head. You
6
- probably don't want to just copy-paste them. The full documentation
7
- for these can be found [here]({{ site.baseurl }}/presets).
8
-
9
- ```yml
10
-
11
- # Media presets are just named css media queries, used in several places:
12
- # - To specify alternate source images (for art direction)
13
- # - To build the 'sizes' attribute
14
- # - When given alternate source images, specify which sizes to generate.
15
- media_presets:
16
- wide_desktop: 'min-width: 1801px'
17
- desktop: 'max-width: 1800px'
18
- wide_tablet: 'max-width: 1200px'
19
- tablet: 'max-width: 900px'
20
- mobile: 'max-width: 600px'
21
-
22
- # Markup presets allow you to group settings together, and select one of them by
23
- # name in your jekyll tag. All settings are optional.
24
- markup_presets:
25
-
26
- default:
27
- # What form the output markup should take:
28
- markup: auto
29
-
30
- # Must be an array, and order matters. Defaults to just 'original', which
31
- # does what you'd expect.
32
- formats: [webp, original]
33
-
34
- # Must be an array: which image sizes (width in pixels) to generate (unless
35
- # directed otherwise below). If not specified, will use sensible default
36
- # values.
37
- widths: [200, 400, 800, 1600]
38
-
39
- # Alternate source images (for art direction) are associated with media
40
- # query presets. Here, you can optionally specify a different set of sizes
41
- # to generate for those alternate source images. This is how you avoid
42
- # generating a 1600 pixel wide image that's only shown on narrow screens.
43
- # Must be arrays.
44
- media_widths:
45
- mobile: [200, 400, 600]
46
- tablet: [400, 600, 800]
47
-
48
- # For building the 'sizes' attribute on img and source tags. specifies how
49
- # wide the image will be when a given media query is true. Note that every
50
- # source in a given <picture> tag will have the same associated sizes
51
- # attribute.
52
- sizes:
53
- mobile: 100vw
54
- tablet: 80vw
55
-
56
- # Specifies an optional, unconditional size attribute. Can be given alone,
57
- # or if specified in combination with 'sizes' below, will be given last
58
- # (when no media queries apply).
59
- size: 800px
60
-
61
- # Specify the properties of the fallback image. If not specified, will
62
- # return a 900 pixel wide image in the original format.
63
- fallback_width: 800
64
- fallback_format: original
65
-
66
- # Add HTML attributes. 'parent' will go to the <picture> tag if it's there,
67
- # otherwise the 'img' tag.
68
- attributes:
69
- parent: 'data-downloadable="true"'
70
- picture: 'class="awesome" data-volume="11"'
71
- img: 'class="some-other-class"'
72
- a: 'class="image-link"'
73
-
74
- # This will wrap images in a link to the original source image. Obviously
75
- # your source images will need to be part of the deployed site for this to
76
- # work. If you have issues such as mangled HTML or extra {::nomarkdown}
77
- # tags floating around, see docs/notes.md
78
- link_source: true
79
-
80
- # This is an example of how you would create a 'multiplier' based srcset;
81
- # useful when an image will always be the same size on all screens (icons,
82
- # graphics, thumbnails, etc), but you'd like to supply higher resolution
83
- # images to devices with higher pixel ratios.
84
- icon:
85
- base_width: 20 # How wide the 1x image should be
86
- pixel_ratios: [1, 1.5, 2]
87
- fallback_width: 20
88
- attributes:
89
- img: 'class="icon"'
90
-
91
- # Here's an example of how you'd configure jekyll-picture-tag to work with
92
- # something like lazyload:
93
- # https://github.com/verlok/lazyload
94
- lazy:
95
- # data_auto gives you data-src, data-srcset, and data-sizes instead of src,
96
- # srcset, and sizes:
97
- markup: data_auto
98
- formats: [webp, original]
99
- widths: [200, 400, 600, 800]
100
- noscript: true # add a fallback image inside a <noscript> tag.
101
- attributes:
102
- img: class="lazy"
103
-
104
- # This is an example of how you'd get generated image and a URL, and nothing
105
- # else.
106
- direct:
107
- markup: direct_url
108
- fallback_format: webp # Default original
109
- fallback_width: 600 # Default 800
110
-
111
- # Here's a naked srcset. Doesn't even give you the surrounding quotes.
112
- srcset:
113
- markup: naked_srcset
114
- formats: [webp] # must be an array, even if it only has one item
115
-
116
- ```
@@ -1,173 +0,0 @@
1
- ---
2
- ---
3
- # Global Configuration
4
-
5
- **All configuration is optional**. If you are happy with the defaults, you don't have to touch a
6
- single yaml file.
7
-
8
- Global settings are stored under the `picture:` key in `/_config.yml`.
9
-
10
- **Example config:**
11
-
12
- ```yml
13
- picture:
14
- source: "assets/images/fullsize"
15
- output: "assets/images/generated"
16
- ```
17
-
18
- * **Source Image Directory**
19
-
20
- *Format:* `source: (directory)`
21
-
22
- *Example:* `source: images/`
23
-
24
- *Default:* Jekyll site root.
25
-
26
- To make writing tags easier you can specify a source directory for your assets. Base images in the
27
- tag will be relative to the `source` directory, which is relative to the Jekyll site root.
28
-
29
- {% raw %}
30
- For example, if `source` is set to `assets/images/_fullsize`, the tag
31
- `{% picture enishte/portrait.jpg --alt An unsual picture %}` will look for a file at
32
- {% endraw %}
33
- `assets/images/_fullsize/enishte/portrait.jpg`.
34
-
35
- * **Destination Image Directory**
36
-
37
- *Format:* `output: (directory)`
38
-
39
- *Example:* `output: resized_images/`
40
-
41
- *Default*: `generated/`
42
-
43
- Jekyll Picture Tag saves resized, reformatted images to the `output` directory in your compiled
44
- site. The organization of your `source` directory is maintained.
45
-
46
- This setting is relative to your compiled site, which means `_site` unless you've changed it.
47
-
48
- * **Suppress Warnings**
49
-
50
- *Format:* `suppress_warnings: (true|false)`
51
-
52
- *Example:* `suppress_warnings: true`
53
-
54
- *Default*: `false`
55
-
56
- Jekyll Picture Tag will warn you in a few different scenarios, such as when your base image is
57
- smaller than one of the sizes in your preset. (Note that Jekyll Picture Tag will never resize an
58
- image to be larger than its source). Set this value to `true`, and these warnings will not be shown.
59
-
60
- * **Continue build with missing source images**
61
-
62
- *Format:* `ignore_missing_images: (boolean|environment name|array of environments)`
63
-
64
- *Example:* `ignore_missing_images: [development, testing]`
65
-
66
- *Default:* `false`
67
-
68
- Normally, JPT will raise an error if a source image is missing, causing the entire site build to
69
- fail. This setting allows you to bypass this behavior and continue the build, either for certain
70
- build environments or all the time. I highly encourage you to set this to `development`, and set
71
- the jekyll build environment to `production` when you build for production so you don't shoot
72
- yourself in the foot (publish a site with broken images). You can read more about Jekyll
73
- environments [here](https://jekyllrb.com/docs/configuration/environments/).
74
-
75
- * **Use Relative Urls**
76
-
77
- *Format:* `relative_url: (true|false)`
78
-
79
- *Example:* `relative_url: false`
80
-
81
- *Default*: `true`
82
-
83
- Whether to use relative (`/generated/test(...).jpg`) or absolute
84
- (`https://example.com/generated/test(...).jpg`) urls in your src and srcset attributes.
85
-
86
- * **Use a CDN Url**
87
-
88
- *Format:* `cdn_url: (url)`
89
-
90
- *Example:* `cdn_url: https://cdn.example.com`
91
-
92
- *Default*: none
93
-
94
- Use for images that are hosted at a different domain or subdomain than the Jekyll site root. Overrides
95
- `relative_url`. Keep reading, the next option is important.
96
-
97
- * **CDN build environments**
98
-
99
- *Format:* `cdn_environments: (array of strings)`
100
-
101
- *Example:* `cdn_environments: ['production', 'staging']`
102
-
103
- *Default*: `['production']`
104
-
105
- It's likely that if you're using a CDN, you may not want to use it in your local development environment. This
106
- allows you to build a site with local images while in development, and still push to a CDN when you build for
107
- production by specifying a different [environment](https://jekyllrb.com/docs/configuration/environments/).
108
-
109
- **Note that the default jekyll environment is `development`**, meaning that if you only set `cdn_url` and run
110
- `jekyll serve` or `jekyll build`, nothing will change. You'll either need to run `JEKYLL_ENV=production bundle exec
111
- jekyll build`, or add `development` to this setting.
112
-
113
- * **Kramdown nomarkdown fix**
114
-
115
- *Format:* `nomarkdown: (true|false)`
116
-
117
- *Example:* `nomarkdown: false`
118
-
119
- *Default:* `true`
120
-
121
- Whether or not to surround j-p-t's output with a `{::nomarkdown}..{:/nomarkdown}` block when called
122
- from within a markdown file.
123
-
124
- This setting is overridden by the same setting in a preset. See [the notes]({{ site.baseurl
125
- }}/notes) for more detailed information.
126
-
127
- * **Fast Build**
128
-
129
- *Format:* `fast_build: (true|false|environment|array of environments)`
130
-
131
- *Examples:*
132
-
133
- - `fast_build: true`
134
-
135
- - `fast_build: development`
136
-
137
- - `fast_build: [development, staging]`
138
-
139
- *Default:* `false`
140
-
141
- Makes a tradeoff: Speeds repeated build times for sites with many images, by assuming that the
142
- filename alone is enough to uniquely identify a source image. This doesn't speed up image
143
- generation, just detection of whether or not it's necessary.
144
-
145
- Ordinarily, JPT generates an MD5 hash for every source image, every site build. This ensures that
146
- if you replace one image with another, but keep the filename the same, JPT will correctly generate
147
- images for the new file. If you have many large images and/or limited hardware, this can take some
148
- time and make the development process painful. Enable this setting to skip MD5 hash checking on
149
- existing generated images (most of the time), and just assume that if the filename, format, and
150
- width match then it's the right one. If there are multiple possible matches (resulting from
151
- leftover generated images from previous filename replacements), it'll compute a hash instead of
152
- guessing randomly.
153
-
154
- * **Disable Jekyll Picture Tag**
155
-
156
- *Format:* `disabled: (true|false|environment|array of environments)`
157
-
158
- *Examples:*
159
-
160
- - `disabled: true`
161
-
162
- - `disabled: development`
163
-
164
- - `disabled: [development, staging]`
165
-
166
- *Default:* `false`
167
-
168
- Disable image and markup generation entirely. Useful for debugging, or to speed up site builds
169
- when you're working on something else.
170
-
171
- Hint: If you're going to toggle this on and off frequently, you might just use an environment
172
- variable. Set this to something like `nopics`, and then start the Jekyll server with something
173
- like `JEKYLL_ENV=nopics bundle exec jekyll serve` when you don't want image generation.
@@ -1,45 +0,0 @@
1
- ---
2
- ---
3
-
4
- # Installation
5
-
6
- - Add `jekyll_picture_tag` to your Gemfile in the `:jekyll_plugins` group:
7
-
8
- ```ruby
9
- group :jekyll_plugins do
10
- gem 'jekyll_picture_tag'
11
- end
12
- ```
13
-
14
- - Run `$ bundle install`
15
-
16
- - See if you have ImageMagick with `$ convert --version`. You should see something like this:
17
-
18
- ```
19
- ~ $ convert --version
20
- Version: ImageMagick 7.0.8-14 Q16 x86_64 2018-10-31 https://imagemagick.org
21
- Copyright: © 1999-2018 ImageMagick Studio LLC License: https://imagemagick.org/script/license.php
22
- Features: Cipher DPC HDRI OpenMP Delegates (built-in): bzlib fontconfig freetype jng jp2 jpeg lcms
23
- lzma pangocairo png tiff webp xml zlib
24
- ```
25
-
26
- If you get a 'command not found' error, you'll need to install it. Most package managers know about
27
- ImageMagick, otherwise it can be found [here](https://imagemagick.org/script/download.php).
28
-
29
- - **Note webp under delegates.** This is required if you want to generate webp files. Any image format
30
- you want to handle will require an appropriate delegate; You may have to install additional packages
31
- to accomplish this.
32
-
33
- ## Cropping and Imagemagick
34
-
35
- Cropping to an aspect ratio depends on ImageMagick 7+. Ubuntu, somewhat annoyingly, only offers
36
- version 6 in its official repositories. This matters even if you don't run Ubuntu, because many
37
- build & deployment services you might use (including Netlify and Travis CI) do.
38
-
39
- If you'd like to use both the cropping feature and such a service, or it's inconvenient to install
40
- version 7 in your development environment, you will likely want to build your site in a docker
41
- container. The Alpine Linux repos include version 7, so you'll want an Alpine Linux based image
42
- rather than an Ubuntu based one. Convenienly this includes the [offical Jekyll
43
- image](https://hub.docker.com/r/jekyll/jekyll).
44
-
45
- Once I work out how to actually do that, I'll add some guidance here.
@@ -1,91 +0,0 @@
1
- ---
2
- ---
3
- # Notes and FAQ
4
-
5
- * #### Github Pages?
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.
10
-
11
- * #### HTML attributes
12
-
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 bit).
16
-
17
- * ### Input checking
18
-
19
- Jekyll Picture Tag is very trusting. It doesn't do much checking of your inputs, and it does not
20
- fail gracefully if you for example pass it a string when it expects an array. It's on the to-do
21
- list, but for now if you get cryptic errors then double-check your settings and tag arguments.
22
-
23
- * ### Git LFS
24
-
25
- I'm Putting this here because it bit me: If you want to use git LFS, make sure that your hosting
26
- provider makes those images available during the build process. Netlify, for example, does not.
27
- You won't find this out until you have gone through the entire migration process and try to deploy
28
- for the first time.
29
-
30
-
31
- * #### Extra {::nomarkdown} tags or mangled HTML?
32
-
33
- **TLDR up front:** There's a bug involving `<picture>` tags wrapped in `<a>` tags which is not in my
34
- power to fix.
35
-
36
- * If you're getting extra `{::nomarkdown}` tags floating around your images, add `nomarkdown:
37
- false` to either the relevant preset or under `picture` in `_config.yml`.
38
-
39
- * If you're getting mangled HTML when trying to wrap images with anchor tags, add `nomarkdown:
40
- true` to the preset.
41
-
42
- **What's going on here:**
43
-
44
- Kramdown is Jekyll's default markdown parser. Kramdown gets grumpy when you give it a block level
45
- element (such as a `<picture>`) surrounded by a span level element (such as an `<a>`), and horribly
46
- mangles it. The fix for this is to tell Kramdown to chill with a `{::nomarkdown}..{:/nomarkdown}`
47
- wrapper.
48
-
49
- Jekyll Picture Tag can be called from many different places: a markdown file, an HTML file, an HTML
50
- layout for a markdown file, and an HTML include, to name a few. JPT tries its best to determine
51
- whether its output will be parsed by Kramdown or not, but Jekyll itself doesn't make this
52
- particularly easy which results in some false positives. (The one I'm most aware of is when a
53
- markdown file uses an HTML layout which includes a picture tag.)
54
-
55
- Unfortunately, I don't see an easy way to fix this. We've gotten this far mostly by trial and error.
56
- I'll continue to work on improving the autodetection, but you can override this behavior explicitly.
57
-
58
- **The fix:**
59
-
60
- By default, JPT will add a `{::nomarkdown}` tag if all of the following are true:
61
- * It thinks it's called from a markdown page
62
- * The image will be wrapped in an anchor tag (i.e. `link_source_image:` or a `--link` parameter)
63
- * This behavior hasn't been explicitly disabled.
64
-
65
- You can disable nomarkdown tags globally by setting `nomarkdown: false` under the `picture:` key in
66
- `_config.yml`.
67
-
68
- You can enable or disable markdown tags per preset by adding `nomarkdown: true|false` to them.
69
- **This setting overrides everything else, both JPT autodetection and the global setting.**
70
-
71
- * ### Managing Generated Images
72
-
73
- Jekyll Picture Tag creates resized versions of your images when you build the site. It uses a
74
- smart caching system to speed up site compilation, and re-uses images as much as possible.
75
- Filenames take the following format:
76
-
77
- `(original name without extension)-(width)-(source hash).(filetype)`
78
-
79
- Source hash is the first 5 characters of an md5 checksum of the source image.
80
-
81
- Try to use a base image that is larger than the largest resized image you need. Jekyll Picture Tag
82
- will warn you if a base image is too small, and won't upscale images.
83
-
84
- By specifying a `source` directory that is ignored by Jekyll you can prevent huge base images from
85
- being copied to the compiled site. For example, `source: assets/images/_fullsize` and `output:
86
- generated` will result in a compiled site that contains resized images but not the originals. Note
87
- that this will break source image linking, if you wish to enable it. (Can't link to images that
88
- aren't public!)
89
-
90
- The `output` directory is never deleted by Jekyll. You may want to empty it once in awhile, to
91
- clear out unused images.
@@ -1,63 +0,0 @@
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 above, 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).
33
-
34
- #### Special Options
35
-
36
- The following preset configuration settings only apply to the `data_` output formats.
37
-
38
- - **noscript**
39
-
40
- _Format:_ `noscript: true|false`
41
-
42
- _Default:_ `false`
43
-
44
- Include a basic `img` fallback within a `<noscript>` tag, giving your javascript-disabled users
45
- something to look at.
46
-
47
- - **data_sizes**
48
-
49
- _Format:_ `data_sizes: true|false`
50
-
51
- _Default:_ `true`
52
-
53
- This option sets whether you would like JPT's auto-generated sizes to be returned as a
54
- `data-sizes` attribute or a normal `sizes` attribute. (Useful for interfacing nicely with all the
55
- various JS image libraries out there.)
56
-
57
- ## Fragments:
58
-
59
- - **`direct_url`**: Generates an image and returns only its url. Uses `fallback_` properties (width
60
- and format).
61
-
62
- - **`naked_srcset`**: Builds a srcset and nothing else (not even the surrounding quotes). Note that the
63
- (image) `format` setting must still be an array, even if you only give it one value.