jekyll_picture_tag 1.10.2 → 2.0.0pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.envrc +4 -0
- data/.github/workflows/code-checks.yml +33 -0
- data/.gitignore +3 -0
- data/.rubocop.yml +32 -0
- data/.ruby-version +1 -1
- data/docs/.envrc +2 -0
- data/docs/Gemfile +4 -2
- data/docs/Gemfile.lock +14 -12
- data/docs/_config.yml +6 -10
- data/docs/devs/contributing/code.md +54 -0
- data/docs/devs/contributing/docs.md +31 -0
- data/docs/devs/contributing/index.md +15 -0
- data/docs/devs/contributing/setup.md +33 -0
- data/docs/devs/contributing/testing.md +23 -0
- data/docs/devs/index.md +7 -0
- data/docs/devs/releases.md +113 -0
- data/docs/index.md +62 -31
- data/docs/logo.png +0 -0
- data/docs/logo.svg +880 -0
- data/docs/users/configuration/directories.md +34 -0
- data/docs/users/configuration/disable.md +24 -0
- data/docs/users/configuration/fast_build.md +28 -0
- data/docs/users/configuration/ignore_missing.md +23 -0
- data/docs/users/configuration/index.md +29 -0
- data/docs/users/configuration/kramdown_fix.md +20 -0
- data/docs/users/configuration/suppress_warnings.md +16 -0
- data/docs/users/configuration/urls.md +69 -0
- data/docs/users/getting_started.md +55 -0
- data/docs/users/index.md +7 -0
- data/docs/users/installation.md +31 -0
- data/docs/users/liquid_tag/argument_reference/alternate_images.md +18 -0
- data/docs/users/liquid_tag/argument_reference/attributes.md +42 -0
- data/docs/users/liquid_tag/argument_reference/base_image.md +12 -0
- data/docs/users/liquid_tag/argument_reference/crop.md +33 -0
- data/docs/users/liquid_tag/argument_reference/link.md +16 -0
- data/docs/users/liquid_tag/argument_reference/preset.md +17 -0
- data/docs/users/liquid_tag/argument_reference/readme.md +9 -0
- data/docs/users/liquid_tag/examples.md +81 -0
- data/docs/users/liquid_tag/index.md +31 -0
- data/docs/users/notes/git_lfs.md +7 -0
- data/docs/users/notes/github_pages.md +5 -0
- data/docs/users/notes/html_attributes.md +5 -0
- data/docs/users/notes/index.md +6 -0
- data/docs/users/notes/kramdown_bug.md +41 -0
- data/docs/users/notes/managing_images.md +21 -0
- data/docs/{migration.md → users/notes/migration_1.md} +1 -1
- data/docs/users/notes/migration_2.md +99 -0
- data/docs/users/presets/cropping.md +60 -0
- data/docs/users/presets/default.md +32 -0
- data/docs/users/presets/examples.md +111 -0
- data/docs/users/presets/fallback_image.md +28 -0
- data/docs/users/presets/html_attributes.md +26 -0
- data/docs/users/presets/image_formats.md +21 -0
- data/docs/users/presets/image_quality.md +120 -0
- data/docs/users/presets/index.md +137 -0
- data/docs/users/presets/link_source.md +16 -0
- data/docs/users/presets/markup_formats/fragments.md +48 -0
- data/docs/users/presets/markup_formats/javascript_friendly.md +57 -0
- data/docs/users/presets/markup_formats/readme.md +43 -0
- data/docs/users/presets/markup_formats/standard_html.md +25 -0
- data/docs/users/presets/media_queries.md +36 -0
- data/docs/users/presets/nomarkdown_override.md +17 -0
- data/docs/users/presets/pixel_ratio_srcsets.md +32 -0
- data/docs/users/presets/quality_width_graph.png +0 -0
- data/docs/users/presets/width_height_attributes.md +34 -0
- data/docs/users/presets/width_srcsets.md +123 -0
- data/docs/users/tutorial.md +97 -0
- data/jekyll_picture_tag.gemspec +38 -24
- data/lib/jekyll_picture_tag.rb +11 -9
- data/lib/jekyll_picture_tag/cache.rb +64 -0
- 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 +4 -0
- data/lib/jekyll_picture_tag/images/generated_image.rb +92 -0
- data/lib/jekyll_picture_tag/images/image_file.rb +90 -0
- data/lib/jekyll_picture_tag/{img_uri.rb → images/img_uri.rb} +4 -10
- data/lib/jekyll_picture_tag/images/source_image.rb +138 -0
- 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 +41 -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 +11 -21
- data/lib/jekyll_picture_tag/output_formats/img.rb +11 -0
- data/lib/jekyll_picture_tag/output_formats/picture.rb +22 -0
- data/lib/jekyll_picture_tag/parsers.rb +5 -0
- data/lib/jekyll_picture_tag/{instructions → parsers}/arg_splitter.rb +4 -3
- 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/preset.rb +43 -0
- data/lib/jekyll_picture_tag/{instructions → parsers}/tag_parser.rb +15 -12
- data/lib/jekyll_picture_tag/router.rb +35 -92
- data/lib/jekyll_picture_tag/srcsets/basic.rb +11 -8
- data/lib/jekyll_picture_tag/utils.rb +24 -20
- data/lib/jekyll_picture_tag/version.rb +1 -1
- data/readme.md +15 -12
- metadata +206 -95
- data/.travis.yml +0 -8
- data/Dockerfile +0 -9
- data/docs/_layouts/directory.html +0 -32
- data/docs/assets/style.css +0 -31
- data/docs/contributing.md +0 -109
- data/docs/example_presets.md +0 -116
- data/docs/global_configuration.md +0 -173
- data/docs/installation.md +0 -45
- data/docs/notes.md +0 -91
- data/docs/output.md +0 -63
- data/docs/presets.md +0 -361
- data/docs/releases.md +0 -65
- data/docs/usage.md +0 -143
- data/jekyll-picture-tag.gemspec +0 -52
- data/lib/jekyll-picture-tag.rb +0 -25
- data/lib/jekyll_picture_tag/defaults/global.yml +0 -11
- data/lib/jekyll_picture_tag/defaults/presets.yml +0 -10
- data/lib/jekyll_picture_tag/generated_image.rb +0 -161
- data/lib/jekyll_picture_tag/instructions/configuration.rb +0 -121
- data/lib/jekyll_picture_tag/instructions/preset.rb +0 -102
- data/lib/jekyll_picture_tag/instructions/set.rb +0 -71
- data/lib/jekyll_picture_tag/source_image.rb +0 -87
@@ -0,0 +1,34 @@
|
|
1
|
+
---
|
2
|
+
sort: 1
|
3
|
+
---
|
4
|
+
|
5
|
+
# Directories
|
6
|
+
|
7
|
+
Define where JPT should look for source images, and where it should place
|
8
|
+
generated images.
|
9
|
+
|
10
|
+
## Source
|
11
|
+
|
12
|
+
*Format:* `source: (directory)`
|
13
|
+
|
14
|
+
*Example:* `source: images/`
|
15
|
+
|
16
|
+
*Default:* Jekyll site root.
|
17
|
+
|
18
|
+
Base directory for your source images, relative to the Jekyll site root. For
|
19
|
+
example, if set to `images/_fullsize`:
|
20
|
+
|
21
|
+
this tag: {% raw %} `{% picture enishte/portrait.jpg %}` {% endraw %}
|
22
|
+
will use this path: `images/_fullsize/enishte/portrait.jpg`.
|
23
|
+
|
24
|
+
## Output
|
25
|
+
|
26
|
+
*Format:* `output: (directory)`
|
27
|
+
|
28
|
+
*Example:* `output: resized_images/`
|
29
|
+
|
30
|
+
*Default*: `generated/`
|
31
|
+
|
32
|
+
Save resized, reformatted images to this directory in your compiled site. The
|
33
|
+
`source` directory structure is maintained. Relative to your compiled site
|
34
|
+
directory, which means `_site/` unless you've changed it.
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
sort: 5
|
3
|
+
---
|
4
|
+
|
5
|
+
# Disable Jekyll Picture Tag
|
6
|
+
|
7
|
+
*Format:* `disabled: (true|false|environment|array of environments)`
|
8
|
+
|
9
|
+
*Examples:*
|
10
|
+
|
11
|
+
- `disabled: true`
|
12
|
+
|
13
|
+
- `disabled: development`
|
14
|
+
|
15
|
+
- `disabled: [development, staging]`
|
16
|
+
|
17
|
+
*Default:* `false`
|
18
|
+
|
19
|
+
Disable image and markup generation entirely. Useful for debugging, or to speed
|
20
|
+
up site builds when you're working on something else.
|
21
|
+
|
22
|
+
Hint: If you're going to toggle this frequently, you might use a Jekyll
|
23
|
+
Environment. Set this to something like `nopics`, and then start Jekyll with
|
24
|
+
`JEKYLL_ENV=nopics bundle exec jekyll serve`.
|
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
sort: 4
|
3
|
+
---
|
4
|
+
|
5
|
+
# Fast Build
|
6
|
+
|
7
|
+
*Format:* `fast_build: (boolean|environment|environments)`
|
8
|
+
|
9
|
+
*Examples:*
|
10
|
+
|
11
|
+
- `fast_build: true`
|
12
|
+
|
13
|
+
- `fast_build: development`
|
14
|
+
|
15
|
+
- `fast_build: [development, staging]`
|
16
|
+
|
17
|
+
*Default:* `false`
|
18
|
+
|
19
|
+
*Might* make your builds faster (depending on hardware and how many images you
|
20
|
+
have) by making a tradeoff: assuming that the filename alone is enough to
|
21
|
+
uniquely identify a source image. This doesn't speed up image generation, just
|
22
|
+
detection of whether or not it's necessary.
|
23
|
+
|
24
|
+
Ordinarily, JPT computes an MD5 hash for every source image, every site build.
|
25
|
+
This ensures that if you replace one image with another, but keep the filename
|
26
|
+
the same, JPT will correctly generate images for the new file. Enable this
|
27
|
+
setting to skip MD5 hash checking and just assume that if the filename, format,
|
28
|
+
and width match then it's the right one.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
sort: 4
|
3
|
+
---
|
4
|
+
|
5
|
+
# Ignore Missing Source Images
|
6
|
+
|
7
|
+
*Format:* `ignore_missing_images: (boolean|environment|environments)`
|
8
|
+
|
9
|
+
*Examples:*
|
10
|
+
- `ignore_missing_images: true`
|
11
|
+
- `ignore_missing_images: development`
|
12
|
+
- `ignore_missing_images: [development, testing]`
|
13
|
+
|
14
|
+
*Default:* `false`
|
15
|
+
|
16
|
+
Normally, JPT will raise an error if a source image is missing, causing the
|
17
|
+
entire site build to fail. This setting allows you to bypass this behavior and
|
18
|
+
continue the build, either for certain build environments or all the time.
|
19
|
+
|
20
|
+
I highly encourage you to set this to `development`, and set the Jekyll build
|
21
|
+
environment to `production` when you build for production so you don't shoot
|
22
|
+
yourself in the foot. You can read more about Jekyll environments
|
23
|
+
[here](https://jekyllrb.com/docs/configuration/environments/).
|
@@ -0,0 +1,29 @@
|
|
1
|
+
---
|
2
|
+
sort: 1
|
3
|
+
---
|
4
|
+
# Global Configuration
|
5
|
+
|
6
|
+
**All configuration is optional**. If you are happy with the defaults, you don't
|
7
|
+
have to touch a single yml file.
|
8
|
+
|
9
|
+
Global settings are stored under the `picture:` key in `/_config.yml`.
|
10
|
+
|
11
|
+
**Example:**
|
12
|
+
|
13
|
+
```yml
|
14
|
+
# _config.yml
|
15
|
+
|
16
|
+
(...)
|
17
|
+
|
18
|
+
picture:
|
19
|
+
source: "assets/images/fullsize"
|
20
|
+
output: "assets/images/generated"
|
21
|
+
suppress_warnings: true
|
22
|
+
(...)
|
23
|
+
|
24
|
+
(...)
|
25
|
+
```
|
26
|
+
|
27
|
+
## Reference
|
28
|
+
|
29
|
+
{% include list.liquid %}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
sort: 6
|
3
|
+
---
|
4
|
+
|
5
|
+
# Kramdown Fix
|
6
|
+
|
7
|
+
*Format:* `nomarkdown: (true|false)`
|
8
|
+
|
9
|
+
*Example:* `nomarkdown: false`
|
10
|
+
|
11
|
+
*Default:* `true`
|
12
|
+
|
13
|
+
Whether or not to surround j-p-t's output with a
|
14
|
+
`{::nomarkdown}..{:/nomarkdown}` block when called from within a markdown file.
|
15
|
+
When false, JPT will never add the wrapper. When true, JPT will add it only when
|
16
|
+
it believes it's necessary, though it's not 100% accurate at making this
|
17
|
+
determination.
|
18
|
+
|
19
|
+
This setting is overridden by the same setting in a preset. See [this note]({{
|
20
|
+
site.baseurl }}/users/notes/kramdown_bug) for more detailed information.
|
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
sort: 3
|
3
|
+
---
|
4
|
+
|
5
|
+
# Suppress Warnings
|
6
|
+
|
7
|
+
*Format:* `suppress_warnings: (true|false)`
|
8
|
+
|
9
|
+
*Example:* `suppress_warnings: true`
|
10
|
+
|
11
|
+
*Default*: `false`
|
12
|
+
|
13
|
+
Jekyll Picture Tag will warn you in a few different scenarios, such as when your
|
14
|
+
base image is smaller than one of the sizes in your preset. (Note that Jekyll
|
15
|
+
Picture Tag will never resize an image to be larger than its source). Set this
|
16
|
+
value to `true`, and these warnings will not be shown.
|
@@ -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,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/index.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
---
|
2
|
+
sort: 1
|
3
|
+
---
|
4
|
+
|
5
|
+
# Installation
|
6
|
+
|
7
|
+
1. Add `jekyll_picture_tag` to your Gemfile in the `:jekyll_plugins` group.
|
8
|
+
|
9
|
+
```note
|
10
|
+
It's NOT `jekyll-picture-tag`.
|
11
|
+
```
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
# Gemfile
|
15
|
+
|
16
|
+
gem 'jekyll', ~> '4.0'
|
17
|
+
|
18
|
+
group :jekyll_plugins do
|
19
|
+
# (other jekyll plugins)
|
20
|
+
gem 'jekyll_picture_tag', ~> '2.0'
|
21
|
+
end
|
22
|
+
```
|
23
|
+
|
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).
|
29
|
+
5. Optional: Install `ImageMagick` for additional image formats. If vips runs into an image format
|
30
|
+
it can't handle (jp2 on my particular installation), JPT will instruct it to try ImageMagick
|
31
|
+
instead.
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
sort: 4
|
3
|
+
---
|
4
|
+
|
5
|
+
# Alternate images
|
6
|
+
|
7
|
+
_Format:_ `(media_query): (filename) [crop] [gravity] (...)`
|
8
|
+
|
9
|
+
_Example:_ `tablet: img_cropped.jpg mobile: img_cropped_more.jpg`
|
10
|
+
|
11
|
+
Optionally specify any number of alternate base images for given
|
12
|
+
[media_queries]({{ site.baseurl }}/users/presets/media_queries). This is called
|
13
|
+
[art direction](http://usecases.responsiveimages.org/#art-direction), and is one
|
14
|
+
of JPT's strongest features.
|
15
|
+
|
16
|
+
Give your images in order of ascending specificity (The first image is the
|
17
|
+
most general). They will be provided to the browser in reverse order, and it
|
18
|
+
will select the first one with an applicable media query.
|
@@ -0,0 +1,42 @@
|
|
1
|
+
---
|
2
|
+
sort: 6
|
3
|
+
---
|
4
|
+
|
5
|
+
# Attributes
|
6
|
+
|
7
|
+
Optionally specify any number of HTML attributes. These will be combined with
|
8
|
+
any which you've set in a preset.
|
9
|
+
|
10
|
+
All arguments which begin with `--` (including `--link`) must be at the end of
|
11
|
+
the liquid tag, but they can be given in any order.
|
12
|
+
|
13
|
+
- **`--alt`**
|
14
|
+
|
15
|
+
_Format:_ `--alt (alt text)`
|
16
|
+
|
17
|
+
_Example:_ `--alt Here is my alt text!`
|
18
|
+
|
19
|
+
Convenience shortcut for `--img alt="..."`
|
20
|
+
|
21
|
+
- **`--(element)`**
|
22
|
+
|
23
|
+
_Format:_ `--(picture|img|source|a|parent) (Standard HTML attributes)`
|
24
|
+
|
25
|
+
_Example:_ `--img class="awesome-fade-in" id="coolio" --a data-awesomeness="11"`
|
26
|
+
|
27
|
+
Apply attributes to a given HTML element. Your options are:
|
28
|
+
|
29
|
+
- `--picture`
|
30
|
+
- `--img`
|
31
|
+
- `--source`
|
32
|
+
- `--a` (anchor tag)
|
33
|
+
- `--parent`
|
34
|
+
|
35
|
+
`--parent` will be applied to the `<picture>` if present, otherwise the
|
36
|
+
`<img>`; useful when using an `auto` output format.
|
37
|
+
|
38
|
+
```note
|
39
|
+
Attributes that are set here for elements which don't occur in the selected
|
40
|
+
markup format will be ignored (e.g. adding `--picture class="cool-css"` with a
|
41
|
+
preset that does not use a `<picture>` tag).
|
42
|
+
```
|
@@ -0,0 +1,12 @@
|
|
1
|
+
---
|
2
|
+
sort: 2
|
3
|
+
---
|
4
|
+
|
5
|
+
# Base Image (Required)
|
6
|
+
|
7
|
+
Can be any raster image (as long as you have the required ImageMagick delegate).
|
8
|
+
Relative to Jekyll's root directory, or the `source` [setting]({{ site.baseurl
|
9
|
+
}}/users/configuration/directories) if you've configured it.
|
10
|
+
|
11
|
+
For filenames with spaces, either use double quotes (`"my image.jpg"`) or a
|
12
|
+
backslash (`my\ image.jpg`).
|
@@ -0,0 +1,33 @@
|
|
1
|
+
---
|
2
|
+
sort: 3
|
3
|
+
---
|
4
|
+
|
5
|
+
# Crop
|
6
|
+
|
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.
|
10
|
+
|
11
|
+
`crop` is given as an aspect ratio in the `width:height` format.
|
12
|
+
|
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:
|
18
|
+
|
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.
|
22
|
+
|
23
|
+
```note
|
24
|
+
Cropping happens before resizing; the preset `widths` setting is a post-crop value.
|
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`
|