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,35 @@
1
+ ---
2
+ sort: 5
3
+ ---
4
+
5
+ # CDN
6
+
7
+ Use for images that are hosted at a different domain or subdomain than the
8
+ Jekyll site root. Overrides `relative_url`.
9
+
10
+ ## URL
11
+
12
+ *Format:* `cdn_url: (url)`
13
+
14
+ *Example:* `cdn_url: https://cdn.example.com`
15
+
16
+ *Default*: none
17
+
18
+ ## Environments
19
+
20
+ It's likely that if you're using a CDN, you may not want to use it in your local
21
+ development environment. This allows you to build a site with local images while
22
+ in development, and still push to a CDN when you build for production by
23
+ specifying a different
24
+ [environment](https://jekyllrb.com/docs/configuration/environments/).
25
+
26
+ *Format:* `cdn_environments: (array of strings)`
27
+
28
+ *Example:* `cdn_environments: ['production', 'staging']`
29
+
30
+ *Default*: `['production']`
31
+
32
+ **Note that the default jekyll environment is `development`**, meaning that if
33
+ you only set `cdn_url` and run `jekyll serve` or `jekyll build`, nothing will
34
+ change. Either run `JEKYLL_ENV=production bundle exec jekyll build`, or add
35
+ `development` to this setting.
@@ -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: 7
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: 3
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: 8
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,15 @@
1
+ ---
2
+ sort: 6
3
+ ---
4
+
5
+ # Use Relative Urls
6
+
7
+ *Format:* `relative_url: (true|false)`
8
+
9
+ *Example:* `relative_url: false`
10
+
11
+ *Default*: `true`
12
+
13
+ Whether to use relative (`/generated/test(...).jpg`) or absolute
14
+ (`https://example.com/generated/test(...).jpg`) urls in your src and srcset
15
+ attributes.
@@ -0,0 +1,16 @@
1
+ ---
2
+ sort: 2
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,7 @@
1
+ ---
2
+ sort: 1
3
+ ---
4
+
5
+ # Usage
6
+
7
+ {% include list.liquid %}
@@ -0,0 +1,52 @@
1
+ ---
2
+ ---
3
+
4
+ # Installation
5
+
6
+ 1. Add `jekyll_picture_tag` to your Gemfile in the `:jekyll_plugins` group.
7
+ (Note that it's NOT `jekyll-picture-tag`):
8
+ ```ruby
9
+ # Gemfile
10
+
11
+ gem 'jekyll'
12
+
13
+ group :jekyll_plugins do
14
+ gem 'jekyll_picture_tag', ~> '1'
15
+ end
16
+ ```
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
+
31
+ ```note
32
+ You need a 'webp' delegate if you want to generate webp files. Any image
33
+ format you want to handle will require an appropriate delegate; You may have
34
+ to install additional packages to accomplish this. Usually it's just named
35
+ 'webp'.
36
+ ```
37
+
38
+ ```warning
39
+ Cropping to an aspect ratio depends on ImageMagick 7+. Ubuntu, somewhat
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.
@@ -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,48 @@
1
+ ---
2
+ sort: 3
3
+ ---
4
+
5
+ # Crop
6
+
7
+ ```warning
8
+ Ensure that both your development and production build environments have
9
+ ImageMagick 7+ installed before using this feature. Anything based on Ubuntu
10
+ likely does not. The installation guide has more information.
11
+ ```
12
+
13
+ Crop an image to a given aspect ratio or size. This argument is given as a
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.
37
+
38
+ ## Examples
39
+
40
+ - `16:9`
41
+ - `1:1 west`
42
+ - `3:2+20+50 northeast`
43
+
44
+ ```note
45
+ If you do a lot of trial and error with these, it's a good idea to manually
46
+ delete your generated images folder more often as each change will build a new
47
+ set of images without removing the old ones.
48
+ ```
@@ -0,0 +1,16 @@
1
+ ---
2
+ sort: 5
3
+ ---
4
+
5
+ # Link
6
+
7
+ _Format:_ `--link (some url)`
8
+
9
+ _Examples_: `--link https://example.com`, `--link /blog/some_post/`
10
+
11
+ Wrap the image in an anchor tag, with the `href` attribute set to whatever
12
+ value you give it. This will override automatic source image linking, if you
13
+ have enabled it.
14
+
15
+ **Note**: If you get either mangled HTML or extra {::nomarkdown} tags when
16
+ using this, read [here]({{ site.baseurl }}/users/notes/kramdown_bug).
@@ -0,0 +1,17 @@
1
+ ---
2
+ sort: 1
3
+ ---
4
+
5
+ # Preset
6
+
7
+ Select a [preset]({{ site.baseurl }}/users/presets), or omit to
8
+ use the `default` preset. A preset is a collection of settings which determines
9
+ nearly everything about JPT's output, from the image formats used to the exact
10
+ format your final HTML will take. Think of it like a recipe or a blueprint; JPT
11
+ will take the information provided in the liquid tag, combine it with the
12
+ settings written in the preset, and use it to craft your images and markup.
13
+
14
+ If the `preset` is omitted then default settings will be used, in the simplest
15
+ case resulting in an `<img>` tag containing a srcset pointing to your newly
16
+ generated images. You are free to override the `default` preset and define
17
+ your own settings, giving full flexibility in what JPT will create.