jekyll_picture_tag 1.13.0 → 2.0.2
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/.envrc +4 -0
- data/.github/workflows/code-checks.yml +33 -0
- data/.gitignore +3 -0
- data/.rubocop.yml +29 -76
- data/.ruby-version +1 -1
- data/docs/.envrc +2 -0
- data/docs/devs/contributing/code.md +14 -4
- data/docs/devs/contributing/docs.md +24 -6
- data/docs/devs/contributing/setup.md +21 -1
- data/docs/devs/contributing/testing.md +19 -37
- data/docs/devs/releases.md +45 -4
- data/docs/index.md +43 -18
- data/docs/logo.png +0 -0
- data/docs/logo.svg +880 -0
- data/docs/users/configuration/disable.md +1 -1
- data/docs/users/configuration/ignore_missing.md +1 -1
- data/docs/users/configuration/kramdown_fix.md +1 -1
- data/docs/users/configuration/suppress_warnings.md +1 -1
- data/docs/users/configuration/urls.md +69 -0
- data/docs/users/deployment.md +49 -0
- data/docs/users/getting_started.md +55 -0
- data/docs/users/installation.md +18 -38
- data/docs/users/liquid_tag/argument_reference/crop.md +21 -36
- data/docs/users/liquid_tag/examples.md +13 -25
- data/docs/users/liquid_tag/index.md +1 -1
- data/docs/users/notes/{migration.md → migration_1.md} +1 -1
- data/docs/users/notes/migration_2.md +99 -0
- data/docs/users/presets/cropping.md +21 -22
- data/docs/users/presets/default.md +11 -2
- data/docs/users/presets/examples.md +77 -45
- data/docs/users/presets/fallback_image.md +1 -1
- data/docs/users/presets/html_attributes.md +1 -1
- data/docs/users/presets/image_formats.md +3 -3
- data/docs/users/presets/image_quality.md +71 -56
- data/docs/users/presets/index.md +19 -45
- data/docs/users/presets/link_source.md +1 -1
- data/docs/users/presets/media_queries.md +1 -1
- data/docs/users/presets/nomarkdown_override.md +1 -1
- data/docs/users/presets/pixel_ratio_srcsets.md +1 -1
- data/docs/users/presets/width_height_attributes.md +1 -1
- data/docs/users/presets/width_srcsets.md +61 -23
- data/docs/users/presets/writing_presets.md +65 -0
- data/docs/users/tutorial.md +97 -0
- data/jekyll_picture_tag.gemspec +38 -23
- data/lib/jekyll_picture_tag.rb +8 -5
- data/lib/jekyll_picture_tag/cache.rb +64 -3
- data/lib/jekyll_picture_tag/defaults/global.rb +18 -0
- data/lib/jekyll_picture_tag/defaults/presets.rb +57 -0
- data/lib/jekyll_picture_tag/images.rb +1 -0
- data/lib/jekyll_picture_tag/images/generated_image.rb +25 -60
- data/lib/jekyll_picture_tag/images/image_file.rb +105 -0
- data/lib/jekyll_picture_tag/images/img_uri.rb +3 -10
- data/lib/jekyll_picture_tag/images/source_image.rb +44 -9
- data/lib/jekyll_picture_tag/instructions.rb +70 -6
- data/lib/jekyll_picture_tag/instructions/children/config.rb +128 -0
- data/lib/jekyll_picture_tag/instructions/children/context.rb +24 -0
- data/lib/jekyll_picture_tag/instructions/children/params.rb +90 -0
- data/lib/jekyll_picture_tag/instructions/children/parsers.rb +48 -0
- data/lib/jekyll_picture_tag/instructions/children/preset.rb +182 -0
- data/lib/jekyll_picture_tag/instructions/parents/conditional_instruction.rb +69 -0
- data/lib/jekyll_picture_tag/instructions/parents/env_instruction.rb +29 -0
- data/lib/jekyll_picture_tag/output_formats/basic.rb +5 -17
- data/lib/jekyll_picture_tag/parsers.rb +6 -0
- data/lib/jekyll_picture_tag/{instructions → parsers}/arg_splitter.rb +1 -1
- data/lib/jekyll_picture_tag/parsers/configuration.rb +28 -0
- data/lib/jekyll_picture_tag/{instructions → parsers}/html_attributes.rb +1 -1
- data/lib/jekyll_picture_tag/parsers/image_backend.rb +33 -0
- data/lib/jekyll_picture_tag/parsers/preset.rb +43 -0
- data/lib/jekyll_picture_tag/{instructions → parsers}/tag_parser.rb +15 -12
- data/lib/jekyll_picture_tag/router.rb +35 -93
- data/lib/jekyll_picture_tag/srcsets/basic.rb +4 -10
- data/lib/jekyll_picture_tag/utils.rb +10 -20
- data/lib/jekyll_picture_tag/version.rb +1 -1
- data/readme.md +48 -9
- metadata +161 -80
- data/.travis.yml +0 -8
- data/Dockerfile +0 -9
- data/docs/users/configuration/cdn.md +0 -35
- data/docs/users/configuration/relative_urls.md +0 -15
- data/docs/users/notes/input_checking.md +0 -6
- data/jekyll-picture-tag.gemspec +0 -52
- data/lib/jekyll-picture-tag.rb +0 -25
- data/lib/jekyll_picture_tag/cache/base.rb +0 -59
- data/lib/jekyll_picture_tag/cache/generated.rb +0 -20
- data/lib/jekyll_picture_tag/cache/source.rb +0 -19
- data/lib/jekyll_picture_tag/defaults/global.yml +0 -11
- data/lib/jekyll_picture_tag/defaults/presets.yml +0 -11
- data/lib/jekyll_picture_tag/instructions/configuration.rb +0 -121
- data/lib/jekyll_picture_tag/instructions/preset.rb +0 -122
- data/lib/jekyll_picture_tag/instructions/set.rb +0 -75
@@ -0,0 +1,69 @@
|
|
1
|
+
---
|
2
|
+
sort: 2
|
3
|
+
---
|
4
|
+
|
5
|
+
# URLs
|
6
|
+
|
7
|
+
## Relative or Absolute
|
8
|
+
|
9
|
+
*Format:* `relative_url: (true|false)`
|
10
|
+
|
11
|
+
*Example:* `relative_url: false`
|
12
|
+
|
13
|
+
*Default*: `true`
|
14
|
+
|
15
|
+
Whether to use relative (`/generated/test(...).jpg`) or absolute
|
16
|
+
(`https://example.com/generated/test(...).jpg`) urls in your src and srcset attributes.
|
17
|
+
|
18
|
+
## Baseurl Key
|
19
|
+
|
20
|
+
*Format:* `baseurl_key: (string)`
|
21
|
+
|
22
|
+
*Example:* `baseurl_key: baseurl_root`
|
23
|
+
|
24
|
+
*Default*: `baseurl`
|
25
|
+
|
26
|
+
Some plugins, such as
|
27
|
+
[jekyll-multiple-languages-plugin](https://github.com/kurtsson/jekyll-multiple-languages-plugin),
|
28
|
+
work by modifying the standard `baseurl` setting, which can break JPT's images. It offers a new
|
29
|
+
setting, `baseurl_root`, which serves as the original `baseurl` setting without a language prefix.
|
30
|
+
Using `baseurl_key`, you can direct JPT to use that setting instead.
|
31
|
+
|
32
|
+
## Ignore Baseurl
|
33
|
+
|
34
|
+
*Format:* `ignore_baseurl: (true|false)`
|
35
|
+
|
36
|
+
*Example:* `ignore_baseurl: true`
|
37
|
+
|
38
|
+
*Default*: `false`
|
39
|
+
|
40
|
+
Depending on your other plugins and configuration, it may be useful for JPT to ignore the baseurl
|
41
|
+
setting entirely.
|
42
|
+
|
43
|
+
## CDN URL
|
44
|
+
|
45
|
+
Use for images that are hosted at a different domain or subdomain than the Jekyll site root.
|
46
|
+
Overrides `relative_url`.
|
47
|
+
|
48
|
+
*Format:* `cdn_url: (url)`
|
49
|
+
|
50
|
+
*Example:* `cdn_url: https://cdn.example.com`
|
51
|
+
|
52
|
+
*Default*: none
|
53
|
+
|
54
|
+
## CDN Environments
|
55
|
+
|
56
|
+
It's likely that if you're using a CDN, you may not want to use it in your local development
|
57
|
+
environment. This allows you to build a site with local images while in development, and still push
|
58
|
+
to a CDN when you build for production by specifying a different
|
59
|
+
[environment](https://jekyllrb.com/docs/configuration/environments/).
|
60
|
+
|
61
|
+
*Format:* `cdn_environments: (array of strings)`
|
62
|
+
|
63
|
+
*Example:* `cdn_environments: ['production', 'staging']`
|
64
|
+
|
65
|
+
*Default*: `['production']`
|
66
|
+
|
67
|
+
**Note that the default jekyll environment is `development`**, meaning that if you only set
|
68
|
+
`cdn_url` and run `jekyll serve` or `jekyll build`, nothing will change. Either run
|
69
|
+
`JEKYLL_ENV=production bundle exec jekyll build`, or add `development` to this setting.
|
@@ -0,0 +1,49 @@
|
|
1
|
+
---
|
2
|
+
sort: 4
|
3
|
+
---
|
4
|
+
|
5
|
+
# Deployment
|
6
|
+
|
7
|
+
Deploying a site with JPT is surprisingly tricky. This is because we depend on system libraries
|
8
|
+
(libvips and its dependencies) to generate images, but build environments have huge variation in
|
9
|
+
what is actually present. Just because a site build works on your local machine, doesn't mean it
|
10
|
+
will work when you try to deploy using a build service.
|
11
|
+
|
12
|
+
Generally, anything which involves building locally and uploading the generated site somewhere, will
|
13
|
+
work. Anything which pulls down a git repository and builds it in some container somewhere needs
|
14
|
+
extra verification. Often some image formats will be supported, while others will not without
|
15
|
+
installing additional packages.
|
16
|
+
|
17
|
+
## Help Wanted
|
18
|
+
|
19
|
+
We could really use help improving this page's guidance. I've created
|
20
|
+
[this](https://github.com/rbuchberger/jekyll_picture_tag/issues/240) issue for feedback; I want to
|
21
|
+
hear how you're deploying with JPT. I want to hear what worked well for you, and what did not. If
|
22
|
+
you're extra motivated and cool, you could make a pull request adding that information to this page.
|
23
|
+
|
24
|
+
## Netlify
|
25
|
+
|
26
|
+
As of March 26, 2021, with version 2.0.0, Netlify is mostly broken. It only supports jpg. I want to
|
27
|
+
support netlify as much as reasonably possible, so if a solution isn't found I'll re-add imagemagick
|
28
|
+
as an alternate backend and offer it as a configurable setting. Until then, stick with version 1.14.
|
29
|
+
|
30
|
+
## AWS S3
|
31
|
+
|
32
|
+
This method has a somewhat difficult setup, but once configured it works _very_ well. Since you
|
33
|
+
build the site locally, if your development build works then your production build will work.
|
34
|
+
|
35
|
+
[This](https://aws.amazon.com/premiumsupport/knowledge-center/cloudfront-serve-static-website/) is
|
36
|
+
the guide you want; **specifically the second option** (Using a website endpoint as the origin, with
|
37
|
+
anonymous (public) access allowed). This allows you to have https and excellent performance.
|
38
|
+
|
39
|
+
For deployment, you'll want to put together either some rake tasks or shell commands to do the
|
40
|
+
following:
|
41
|
+
|
42
|
+
* build: `JEKYLL_ENV=production bundle exec jekyll build`
|
43
|
+
* push: `aws s3 sync _site s3://(your bucket here)`
|
44
|
+
* invalidate: `aws cloudfront create-invalidation --distribution-id (your distribution id here) --paths '/*'`
|
45
|
+
* Cloudfront caches assets for 24 hours. This command invalidates that cache, so your changes go
|
46
|
+
live immediately.
|
47
|
+
* deploy: `build && push && invalidate`
|
48
|
+
|
49
|
+
(All of these depend on having the aws cli installed, with proper credentials configured.)
|
@@ -0,0 +1,55 @@
|
|
1
|
+
---
|
2
|
+
sort: 2
|
3
|
+
---
|
4
|
+
|
5
|
+
# Getting started
|
6
|
+
|
7
|
+
Firstly, let me warn you that responsive images are somewhat complicated, and fall squarely into
|
8
|
+
"proper web development" territory. To do this well, you will need to do some learning. The default
|
9
|
+
settings are a starting point, meant to get you up and running with something reasonable while
|
10
|
+
minimizing unexpected behavior.
|
11
|
+
|
12
|
+
Here are some good guides:
|
13
|
+
|
14
|
+
* [MDN Responsive Images guide](https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images)
|
15
|
+
* [CSS Tricks Guide to Reponsive Images](https://css-tricks.com/a-guide-to-the-responsive-images-syntax-in-html/)
|
16
|
+
* [Cloud 4 - Responsive Images 101](https://cloudfour.com/thinks/responsive-images-101-definitions/)
|
17
|
+
|
18
|
+
## Step 1: Customize global settings
|
19
|
+
|
20
|
+
JPT's [global configuration](configuration) happens under the `picture:` key in `_config.yml`. The
|
21
|
+
defaults are probably fine, though you may want to configure the input and output
|
22
|
+
[directories](configuration/directories).
|
23
|
+
|
24
|
+
## Step 2: Test & Learn
|
25
|
+
|
26
|
+
- If you're not already familiar, there's a short [tutorial](tutorial) to get you started with the basics.
|
27
|
+
- Look over the [example presets](presets/examples)
|
28
|
+
- Look over the [example liquid tags](liquid_tag/examples) and [instructions](liquid_tag).
|
29
|
+
|
30
|
+
## Step 3: Add breakpoints
|
31
|
+
|
32
|
+
Once you have a feel for how this plugin works, it's time to adapt it to your particular site. The
|
33
|
+
built-in `jpt-` media queries probably don't quite fit your layout; Find whatever breakpoints your
|
34
|
+
css uses, and tell JPT about them:
|
35
|
+
|
36
|
+
1. Create `_data/picture.yml`
|
37
|
+
2. List them under the `media_queries:` key. Give them easy-to-remember names, and wrap them in
|
38
|
+
single quotes.
|
39
|
+
|
40
|
+
```yaml
|
41
|
+
# _data/picture.yml
|
42
|
+
|
43
|
+
media_queries:
|
44
|
+
(name): '(media query)'
|
45
|
+
(...)
|
46
|
+
|
47
|
+
```
|
48
|
+
|
49
|
+
If you're using bootstrap or something, you don't need to plug in every single breakpoint they have,
|
50
|
+
just a handful that you'll actually use.
|
51
|
+
|
52
|
+
## Step 4: Write presets
|
53
|
+
|
54
|
+
From there, it's time to [write your own presets](presets). Start with the `default`, and then move
|
55
|
+
on to cover all the different ways you use images in your site.
|
data/docs/users/installation.md
CHANGED
@@ -1,52 +1,32 @@
|
|
1
1
|
---
|
2
|
+
sort: 1
|
2
3
|
---
|
3
4
|
|
4
5
|
# Installation
|
5
6
|
|
6
7
|
1. Add `jekyll_picture_tag` to your Gemfile in the `:jekyll_plugins` group.
|
7
|
-
|
8
|
+
|
9
|
+
```note
|
10
|
+
It's NOT `jekyll-picture-tag`.
|
11
|
+
```
|
12
|
+
|
8
13
|
```ruby
|
9
14
|
# Gemfile
|
10
15
|
|
11
|
-
gem 'jekyll'
|
16
|
+
gem 'jekyll', ~> '4.0'
|
12
17
|
|
13
18
|
group :jekyll_plugins do
|
14
|
-
|
19
|
+
# (other jekyll plugins)
|
20
|
+
gem 'jekyll_picture_tag', ~> '2.0'
|
15
21
|
end
|
16
22
|
```
|
17
|
-
2. Run `$ bundle install`
|
18
|
-
3. See if you have ImageMagick with `$ convert --version`. You should see
|
19
|
-
something like this:
|
20
|
-
```bash
|
21
|
-
~ $ convert --version
|
22
|
-
Version: ImageMagick 7.0.8-14 Q16 x86_64 2018-10-31 https://imagemagick.org
|
23
|
-
Copyright: © 1999-2018 ImageMagick Studio LLC License: https://imagemagick.org/script/license.php
|
24
|
-
Features: Cipher DPC HDRI OpenMP Delegates (built-in): bzlib fontconfig freetype jng jp2 jpeg lcms
|
25
|
-
lzma pangocairo png tiff webp xml zlib
|
26
|
-
```
|
27
|
-
If you get a 'command not found' error, you'll need to install it. Most
|
28
|
-
package managers know about ImageMagick, otherwise it can be found
|
29
|
-
[here](https://imagemagick.org/script/download.php).
|
30
23
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
annoyingly, only offers version 6 in its official repositories. This matters
|
41
|
-
even if you don't run Ubuntu, because many build & deployment services you might
|
42
|
-
use (including Netlify and Travis CI) do.
|
43
|
-
```
|
44
|
-
|
45
|
-
If you'd like to use both the cropping feature and such a service, or it's
|
46
|
-
inconvenient to install version 7 in your development environment, you will
|
47
|
-
likely want to build your site in a docker container. The Alpine Linux repos
|
48
|
-
include version 7, so you'll want an Alpine Linux based image rather than an
|
49
|
-
Ubuntu based one. Conveniently this includes the [offical Jekyll
|
50
|
-
image](https://hub.docker.com/r/jekyll/jekyll).
|
51
|
-
|
52
|
-
Once I work out how to actually do that, I'll add some guidance here.
|
24
|
+
2. Run `$ bundle install`
|
25
|
+
3. Install `libvips`. Most package managers know about it, otherwise it can be found
|
26
|
+
[here](https://libvips.github.io/libvips/install.html).
|
27
|
+
4. Install libvips dependencies for all image formats you will use, such as `libpng`, `libwebp`,
|
28
|
+
`libjpeg`, and `libheif` (for avif). Note that if you use a deployment or CI service, these
|
29
|
+
dependencies will be required there as well.
|
30
|
+
5. Optional: Install `ImageMagick` for additional image formats. If vips runs into an image format
|
31
|
+
it can't handle (jp2 on my particular installation), JPT will instruct it to try ImageMagick
|
32
|
+
instead.
|
@@ -4,45 +4,30 @@ sort: 3
|
|
4
4
|
|
5
5
|
# Crop
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
likely does not. The installation guide has more information.
|
11
|
-
```
|
7
|
+
Crop an image to a given aspect ratio. This argument is given as a `crop` and (optionally) a `keep`
|
8
|
+
setting. The values given here will override the preset settings (if present), can be given after
|
9
|
+
every image, and apply only to the preceding image.
|
12
10
|
|
13
|
-
|
14
|
-
`geometry` and (optionally) a `gravity`, which can appear in either order and
|
15
|
-
are thin wrappers around ImageMagick's
|
16
|
-
[geometry](http://www.imagemagick.org/script/command-line-processing.php#geometry)
|
17
|
-
and
|
18
|
-
[gravity](http://www.imagemagick.org/script/command-line-options.php#gravity)
|
19
|
-
settings. The values given here will override the preset settings (if present),
|
20
|
-
can be given after every image, and apply only to the preceding image.
|
21
|
-
|
22
|
-
Geometry can take many forms, but most likely you'll want to set an aspect
|
23
|
-
ratio-- given in the standard `width:height` ratio such as `3:2`. Gravity sets
|
24
|
-
which portion of the image to keep, and is given in compass directions (`north`,
|
25
|
-
`southeast`, etc) or `center` (default). Cropping happens before resizing; the
|
26
|
-
preset `widths` setting is a post-crop value.
|
27
|
-
|
28
|
-
If you'd like more fine-grained control, this can be offset by appending `+|-x`
|
29
|
-
and (optionally) `y` pixel values to the _geometry_ (not the gravity!). Example:
|
30
|
-
`1:1+400 west` means "Crop to a 1:1 aspect ratio, starting 400 pixels from the
|
31
|
-
left side.", and `north 3:2+0+100` means "Crop to 3:2, starting 100 pixels from
|
32
|
-
the top." These can get a bit persnickety; there's nothing to stop you from
|
33
|
-
running off the side of the image. Pay attention.
|
34
|
-
|
35
|
-
For detailed documentation, see ImageMagick's
|
36
|
-
[crop](http://www.imagemagick.org/script/command-line-options.php#crop) tool.
|
11
|
+
`crop` is given as an aspect ratio in the `width:height` format.
|
37
12
|
|
38
|
-
|
13
|
+
`keep` sets which portion of the image to keep; it's the
|
14
|
+
['interestingness'](https://libvips.github.io/libvips/API/current/libvips-conversion.html#VipsInteresting)
|
15
|
+
setting passed to the [libvips
|
16
|
+
smartcrop](https://libvips.github.io/libvips/API/current/libvips-conversion.html#vips-smartcrop)
|
17
|
+
function. Your options are:
|
39
18
|
|
40
|
-
|
41
|
-
|
42
|
-
|
19
|
+
* `attention` - automagically keep parts likely to draw human attention. **Default**
|
20
|
+
* `entropy` - Crop out the parts with the least variation.
|
21
|
+
* `center` or `centre` - Keep the middle part.
|
43
22
|
|
44
23
|
```note
|
45
|
-
|
46
|
-
delete your generated images folder more often as each change will build a new
|
47
|
-
set of images without removing the old ones.
|
24
|
+
Cropping happens before resizing; the preset `widths` setting is a post-crop value.
|
48
25
|
```
|
26
|
+
|
27
|
+
More fine-grained control is beyond the scope of this plugin. I'm not writing an image editor here!
|
28
|
+
|
29
|
+
## Examples
|
30
|
+
|
31
|
+
- `16:9`
|
32
|
+
- `1:1 entropy`
|
33
|
+
- `3:2 center`
|
@@ -27,44 +27,32 @@
|
|
27
27
|
|
28
28
|
* Use liquid variables:
|
29
29
|
```
|
30
|
-
{% picture {{ page.some_liquid_variable }} %}
|
30
|
+
{% picture "{{ page.some_liquid_variable }}" %}
|
31
31
|
```
|
32
32
|
|
33
33
|
* Select the blog_index preset, use liquid variables, and wrap the image in an
|
34
34
|
anchor tag (link):
|
35
35
|
```
|
36
|
-
{% picture blog_index {{ post.image }} --link {{ post.url }} %}
|
37
|
-
```
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
{% picture blog_index "{{ post.image }}" %}
|
42
|
-
```
|
43
|
-
* __Nulls & Blanks__: you need to wrap whole tag in a logic block to stop an uncaught Liquid exception:
|
44
|
-
```
|
45
|
-
{% if post.image && post.image != "" %}
|
46
|
-
{% picture blog_index "{{ post.image }}" %}
|
47
|
-
{% endif %}
|
48
|
-
```
|
49
|
-
|
36
|
+
{% picture blog_index "{{ post.image }}" --link {{ post.url }} %}
|
37
|
+
```
|
38
|
+
|
39
|
+
**Note:** If the image path is coming from a liquid variable then you should guard against spaces
|
40
|
+
by wrapping the inner tag in quotes, as in the previous examples.
|
50
41
|
|
51
42
|
* Add arbitrary HTML attributes:
|
52
43
|
```
|
53
44
|
{% picture example.jpg --picture class="some classes" --img id="example" %}
|
54
45
|
```
|
55
46
|
|
56
|
-
|
57
|
-
|
58
|
-
```
|
59
|
-
|
60
|
-
* Crop to a 16:9 aspect ratio, keeping the top:
|
47
|
+
* Crop to a 16:9 aspect ratio (Will keep the part of the image "most likely to
|
48
|
+
draw human attention"):
|
61
49
|
```
|
62
|
-
{% picture example.jpg 16:9
|
50
|
+
{% picture example.jpg 16:9 %}
|
63
51
|
```
|
64
52
|
|
65
53
|
* Crop to a 1:1 aspect ratio, keeping the middle, with alt text:
|
66
54
|
```
|
67
|
-
{% picture thumbnail example.jpg 1:1 --alt Example Image %}
|
55
|
+
{% picture thumbnail example.jpg 1:1 center --alt Example Image %}
|
68
56
|
```
|
69
57
|
|
70
58
|
* Crop the same image multiple times:
|
@@ -82,9 +70,9 @@
|
|
82
70
|
{%
|
83
71
|
picture
|
84
72
|
hero
|
85
|
-
example.jpg 16:9
|
86
|
-
tablet: example2.jpg 3:2
|
87
|
-
mobile: example3.jpg 1:1
|
73
|
+
example.jpg 16:9 entropy
|
74
|
+
tablet: example2.jpg 3:2
|
75
|
+
mobile: example3.jpg 1:1
|
88
76
|
--alt Happy Puppy
|
89
77
|
--picture class="hero"
|
90
78
|
--link /
|
@@ -22,7 +22,7 @@ fine, and you can use liquid variables anywhere.
|
|
22
22
|
|
23
23
|
* `(image)` - required.
|
24
24
|
|
25
|
-
* `crop` -
|
25
|
+
* `crop` - Aspect ratio & keep settings.
|
26
26
|
|
27
27
|
* `alternate images & crops` - Art Direction; show different images on different
|
28
28
|
devices. Give in order of ascending specificity.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
---
|
3
|
-
# Migrating from
|
3
|
+
# Migrating from 0.x to 1.x
|
4
4
|
|
5
5
|
This document details the changes from previous versions (Everything before 1.0), and how to migrate
|
6
6
|
an existing site to the new version. It won't be updated to reflect new features -- it simply
|
@@ -0,0 +1,99 @@
|
|
1
|
+
---
|
2
|
+
---
|
3
|
+
# Migrating from 1.x to 2.x
|
4
|
+
|
5
|
+
There are a few breaking changes from 1.x versions, but they've been minimized and hopefully they
|
6
|
+
won't affect you too badly. This is a guide to transitioning an existing site; We don't go into all
|
7
|
+
the new features here, except where they replace or modify existing ones.
|
8
|
+
|
9
|
+
- For easy skimming, anything with a bullet point (like this line) is something you need to
|
10
|
+
check/do.
|
11
|
+
|
12
|
+
## Libvips
|
13
|
+
|
14
|
+
- Install Libvips, both in development and production. Any reasonably recent version will do.
|
15
|
+
|
16
|
+
We still fall back to ImageMagick when Vips doesn't support a given image format, so there's no
|
17
|
+
reason to uninstall it. However, we no longer require version 7. Version 6+ is fine, which makes
|
18
|
+
deployments involving Ubuntu much easier.
|
19
|
+
|
20
|
+
## Jekyll 4.0+
|
21
|
+
|
22
|
+
- Update to Jekyll 4.x
|
23
|
+
|
24
|
+
We're removing support for versions of Jekyll before 4.0. I did it inadvertently awhile ago with the
|
25
|
+
fast_build setting, now it's official. If this causes you a great deal of pain, speak up and we'll
|
26
|
+
look into supporting older versions.
|
27
|
+
|
28
|
+
## Ruby 2.6+
|
29
|
+
|
30
|
+
- Ensure you're running Ruby 2.6 or later.
|
31
|
+
|
32
|
+
While Jekyll supports 2.4, it's officialy EOL and 2.5 (our previous target) is in security
|
33
|
+
maintenance only. Since I want major version releases to be as rare as possible, we're making this
|
34
|
+
move now. Again, speak up if this causes a great deal of pain.
|
35
|
+
|
36
|
+
## Image quality & write options.
|
37
|
+
|
38
|
+
- If you have set `quality:` in a preset, it will stop having an effect for webp, avif, and jp2
|
39
|
+
images. You need to set `format_quality:` instead.
|
40
|
+
|
41
|
+
Previously, all image formats used a default quality of 75. We have now set a default quality for 3
|
42
|
+
formats:
|
43
|
+
|
44
|
+
```yml
|
45
|
+
format_quality:
|
46
|
+
webp: 50
|
47
|
+
avif: 30
|
48
|
+
jp2: 30
|
49
|
+
```
|
50
|
+
|
51
|
+
Since `format_quality` overrides `quality`, your `quality` setting won't affect those formats
|
52
|
+
anymore.
|
53
|
+
|
54
|
+
- Lossless webp or avif was previously accomplished by setting quality to 100. Now, that is
|
55
|
+
accomplished with an image option:
|
56
|
+
|
57
|
+
```yml
|
58
|
+
#_data/picture.yml
|
59
|
+
presets:
|
60
|
+
|
61
|
+
my_preset:
|
62
|
+
image_options:
|
63
|
+
webp:
|
64
|
+
lossless: true
|
65
|
+
```
|
66
|
+
|
67
|
+
## Setting names changing
|
68
|
+
|
69
|
+
In `_data/picture.yml`,
|
70
|
+
- `markup_presets` is now `presets`
|
71
|
+
- `media_presets` is now `media_queries`.
|
72
|
+
|
73
|
+
Go check, especially if you've been using JPT for awhile. We renamed them several versions ago, but
|
74
|
+
the old names were still supported until now. If you get a bunch of 'preset not found' warnings,
|
75
|
+
this is probably why.
|
76
|
+
|
77
|
+
|
78
|
+
## Crop changes
|
79
|
+
|
80
|
+
- Anywhere you've set a crop geometry in any format other than `w:h`, remove or change it. This
|
81
|
+
could be in both tags and presets.
|
82
|
+
- Anywhere you've set a crop gravity such as `north` or `southeast`, remove it. This could also be
|
83
|
+
in both tags and presets.
|
84
|
+
- Build the site, look through cropped images and decide if you like the results. Adjust the new
|
85
|
+
`keep` setting if desired.
|
86
|
+
|
87
|
+
We now use the Libvips smartcrop feature which does some magic to keep the most interesting part.
|
88
|
+
`gravity` is now `keep` (as in which part of the image to keep), and your options are `attention`,
|
89
|
+
`entropy`, or `centre`/`center`. The default is `attention`, and it works pretty well in my testing
|
90
|
+
so far.
|
91
|
+
|
92
|
+
If you can't get satisfactory results with those options, you'll have to use a proper editor. JPT is
|
93
|
+
not one, and the old crop feature went too far down the road of trying to be.
|
94
|
+
|
95
|
+
## Naming of presets and media queries
|
96
|
+
|
97
|
+
- If you have any presets or media queries with names that start with `jpt-`, change them.
|
98
|
+
|
99
|
+
We're cordoning off a namespace for built-in ones.
|