jekyll_picture_tag 1.13.0 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/.envrc +4 -0
  3. data/.github/workflows/code-checks.yml +33 -0
  4. data/.gitignore +3 -0
  5. data/.rubocop.yml +29 -76
  6. data/.ruby-version +1 -1
  7. data/docs/.envrc +2 -0
  8. data/docs/devs/contributing/code.md +14 -4
  9. data/docs/devs/contributing/docs.md +24 -6
  10. data/docs/devs/contributing/setup.md +21 -1
  11. data/docs/devs/contributing/testing.md +19 -37
  12. data/docs/devs/releases.md +45 -4
  13. data/docs/index.md +43 -18
  14. data/docs/logo.png +0 -0
  15. data/docs/logo.svg +880 -0
  16. data/docs/users/configuration/disable.md +1 -1
  17. data/docs/users/configuration/ignore_missing.md +1 -1
  18. data/docs/users/configuration/kramdown_fix.md +1 -1
  19. data/docs/users/configuration/suppress_warnings.md +1 -1
  20. data/docs/users/configuration/urls.md +69 -0
  21. data/docs/users/deployment.md +49 -0
  22. data/docs/users/getting_started.md +55 -0
  23. data/docs/users/installation.md +18 -38
  24. data/docs/users/liquid_tag/argument_reference/crop.md +21 -36
  25. data/docs/users/liquid_tag/examples.md +13 -25
  26. data/docs/users/liquid_tag/index.md +1 -1
  27. data/docs/users/notes/{migration.md → migration_1.md} +1 -1
  28. data/docs/users/notes/migration_2.md +99 -0
  29. data/docs/users/presets/cropping.md +21 -22
  30. data/docs/users/presets/default.md +11 -2
  31. data/docs/users/presets/examples.md +77 -45
  32. data/docs/users/presets/fallback_image.md +1 -1
  33. data/docs/users/presets/html_attributes.md +1 -1
  34. data/docs/users/presets/image_formats.md +3 -3
  35. data/docs/users/presets/image_quality.md +71 -56
  36. data/docs/users/presets/index.md +19 -45
  37. data/docs/users/presets/link_source.md +1 -1
  38. data/docs/users/presets/media_queries.md +1 -1
  39. data/docs/users/presets/nomarkdown_override.md +1 -1
  40. data/docs/users/presets/pixel_ratio_srcsets.md +1 -1
  41. data/docs/users/presets/width_height_attributes.md +1 -1
  42. data/docs/users/presets/width_srcsets.md +61 -23
  43. data/docs/users/presets/writing_presets.md +65 -0
  44. data/docs/users/tutorial.md +97 -0
  45. data/jekyll_picture_tag.gemspec +38 -23
  46. data/lib/jekyll_picture_tag.rb +8 -5
  47. data/lib/jekyll_picture_tag/cache.rb +64 -3
  48. data/lib/jekyll_picture_tag/defaults/global.rb +18 -0
  49. data/lib/jekyll_picture_tag/defaults/presets.rb +57 -0
  50. data/lib/jekyll_picture_tag/images.rb +1 -0
  51. data/lib/jekyll_picture_tag/images/generated_image.rb +25 -60
  52. data/lib/jekyll_picture_tag/images/image_file.rb +105 -0
  53. data/lib/jekyll_picture_tag/images/img_uri.rb +3 -10
  54. data/lib/jekyll_picture_tag/images/source_image.rb +44 -9
  55. data/lib/jekyll_picture_tag/instructions.rb +70 -6
  56. data/lib/jekyll_picture_tag/instructions/children/config.rb +128 -0
  57. data/lib/jekyll_picture_tag/instructions/children/context.rb +24 -0
  58. data/lib/jekyll_picture_tag/instructions/children/params.rb +90 -0
  59. data/lib/jekyll_picture_tag/instructions/children/parsers.rb +48 -0
  60. data/lib/jekyll_picture_tag/instructions/children/preset.rb +182 -0
  61. data/lib/jekyll_picture_tag/instructions/parents/conditional_instruction.rb +69 -0
  62. data/lib/jekyll_picture_tag/instructions/parents/env_instruction.rb +29 -0
  63. data/lib/jekyll_picture_tag/output_formats/basic.rb +5 -17
  64. data/lib/jekyll_picture_tag/parsers.rb +6 -0
  65. data/lib/jekyll_picture_tag/{instructions → parsers}/arg_splitter.rb +1 -1
  66. data/lib/jekyll_picture_tag/parsers/configuration.rb +28 -0
  67. data/lib/jekyll_picture_tag/{instructions → parsers}/html_attributes.rb +1 -1
  68. data/lib/jekyll_picture_tag/parsers/image_backend.rb +33 -0
  69. data/lib/jekyll_picture_tag/parsers/preset.rb +43 -0
  70. data/lib/jekyll_picture_tag/{instructions → parsers}/tag_parser.rb +15 -12
  71. data/lib/jekyll_picture_tag/router.rb +35 -93
  72. data/lib/jekyll_picture_tag/srcsets/basic.rb +4 -10
  73. data/lib/jekyll_picture_tag/utils.rb +10 -20
  74. data/lib/jekyll_picture_tag/version.rb +1 -1
  75. data/readme.md +48 -9
  76. metadata +161 -80
  77. data/.travis.yml +0 -8
  78. data/Dockerfile +0 -9
  79. data/docs/users/configuration/cdn.md +0 -35
  80. data/docs/users/configuration/relative_urls.md +0 -15
  81. data/docs/users/notes/input_checking.md +0 -6
  82. data/jekyll-picture-tag.gemspec +0 -52
  83. data/lib/jekyll-picture-tag.rb +0 -25
  84. data/lib/jekyll_picture_tag/cache/base.rb +0 -59
  85. data/lib/jekyll_picture_tag/cache/generated.rb +0 -20
  86. data/lib/jekyll_picture_tag/cache/source.rb +0 -19
  87. data/lib/jekyll_picture_tag/defaults/global.yml +0 -11
  88. data/lib/jekyll_picture_tag/defaults/presets.yml +0 -11
  89. data/lib/jekyll_picture_tag/instructions/configuration.rb +0 -121
  90. data/lib/jekyll_picture_tag/instructions/preset.rb +0 -122
  91. data/lib/jekyll_picture_tag/instructions/set.rb +0 -75
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46fd8634e4d9eff8493b340560d84e8a398eb77db81a511529f0b670f111de7c
4
- data.tar.gz: 103f00baec1839e018094b5c3d3522ecff13849e3bda46353ddde9e70e2040fb
3
+ metadata.gz: 61b3c53bfa81070e0457626c7ffe32c528bd6cafcc6627b5899d4737f83e2fd8
4
+ data.tar.gz: 25abc195daaee489892452b4fb1622fcb4585e1b09ee34bb1a2a4b568d2a1f68
5
5
  SHA512:
6
- metadata.gz: 14afd21d6a1cd36bac48b20e79047e1df845b458e763d0eb590125fa45dd2eef431cc27836f22073878d807dc5118787f40fe8b2ffc15579bd6edf4c70f0411b
7
- data.tar.gz: bd9131318cd312b340ff337db88127c9b8b14f78c2bfc64ec04dd6f9d27db87a08d36a59bf5aa550f51ede5c2a6b9cdda8554c60f2cecc64db5e914a1f28a84f
6
+ metadata.gz: 075f856f3407ee8e1c68f785759a600ea04ddbfcff08944fd4796157c842a2c0583044b726580ed5030b81fd0f8b82c962345e583eef4c492fd2edda7a03fe48
7
+ data.tar.gz: 66f7afa3af4d32ac61d67e21f4a7844d86c2f195043f3f607b706a30a40e3be040e21654ef601cd5f12edf7535f6e1401edb2ae1f17a50c56de91eb5b1a03c70
data/.envrc ADDED
@@ -0,0 +1,4 @@
1
+ # if you run bundle install --binstubs, you won't have to use bundle exec all the time.
2
+ export PATH=$(git rev-parse --show-toplevel)/bin:$PATH
3
+ # Suppress a few vips warnings that pop up during the tests
4
+ export VIPS_WARNING=0
@@ -0,0 +1,33 @@
1
+ name: 'Tests & Formatting'
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+ schedule:
9
+ # Run weekly; github deletes caches that haven't been used in a week.
10
+ - cron: '0 0 * * 0'
11
+
12
+ jobs:
13
+ checks:
14
+ runs-on: ubuntu-20.04
15
+
16
+ steps:
17
+
18
+ - name: Install system dependencies
19
+ run: sudo apt install libjpeg-dev webp libpng-dev libavifile-0.7c2 libopenjpip7 imagemagick libvips-tools
20
+
21
+ - name: Checkout repo
22
+ uses: actions/checkout@v2
23
+
24
+ # Version taken from .ruby-version file.
25
+ # Also runs bundle install.
26
+ - name: Install Ruby
27
+ uses: ruby/setup-ruby@v1
28
+ with:
29
+ bundler-cache: true
30
+
31
+ - run: bundle exec rake test
32
+
33
+ - run: bundle exec rubocop
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  /.bundle/
2
+ /docs/.bundle/
2
3
  /.yardoc
3
4
  /Gemfile.lock
4
5
  /_yardoc/
@@ -13,3 +14,5 @@ jekyll-picture-tag.iml
13
14
  /docs/_site/
14
15
  /docs/.jekyll-cache/
15
16
  /docs/.sass-cache/
17
+ /bin/
18
+ /docs/bin/
data/.rubocop.yml CHANGED
@@ -1,81 +1,34 @@
1
- # Disabled
1
+ # Exclude unimportant files
2
+ require:
3
+ - rubocop-minitest
4
+ - rubocop-rake
5
+
6
+ AllCops:
7
+ NewCops: enable
8
+ Include:
9
+ - 'lib/**/*.rb'
10
+ - 'test/**/*.rb'
11
+ - 'Gemfile'
12
+ - 'Rakefile'
13
+ - '*.gemspec'
14
+
15
+ Exclude:
16
+ - '**/.bundle/*'
17
+ - '**/.git/*'
18
+ - '**/.github/*'
19
+ - '**/bin/**/*'
20
+ - '**/coverage/**/*'
21
+ - '**/docs/**/*'
22
+ - '**/imagemagick/*'
23
+ - '**/pkg/**/*'
24
+ - '**/vendor/**/*'
25
+
26
+ Layout/LineLength:
27
+ Max: 80
28
+
29
+ # Disabled Cops
2
30
  Style/FrozenStringLiteralComment:
3
31
  Enabled: false
4
32
 
5
33
  Style/StringConcatenation:
6
34
  Enabled: false
7
-
8
- # New cops, enabled. We aren't using the 'NewCops' setting because then rubocop
9
- # updates can break our CI.
10
- Layout/EmptyLinesAroundAttributeAccessor:
11
- Enabled: true
12
- Layout/SpaceAroundMethodCallOperator:
13
- Enabled: true
14
- Lint/BinaryOperatorWithIdenticalOperands:
15
- Enabled: true
16
- Lint/DeprecatedOpenSSLConstant:
17
- Enabled: true
18
- Lint/DuplicateElsifCondition:
19
- Enabled: true
20
- Lint/DuplicateRescueException:
21
- Enabled: true
22
- Lint/EmptyConditionalBody:
23
- Enabled: true
24
- Lint/FloatComparison:
25
- Enabled: true
26
- Lint/MissingSuper:
27
- Enabled: true
28
- Lint/MixedRegexpCaptureTypes:
29
- Enabled: true
30
- Lint/OutOfRangeRegexpRef:
31
- Enabled: true
32
- Lint/RaiseException:
33
- Enabled: true
34
- Lint/SelfAssignment:
35
- Enabled: true
36
- Lint/StructNewOverride:
37
- Enabled: true
38
- Lint/TopLevelReturnWithArgument:
39
- Enabled: true
40
- Lint/UnreachableLoop:
41
- Enabled: true
42
- Style/AccessorGrouping:
43
- Enabled: true
44
- Style/ArrayCoercion:
45
- Enabled: true
46
- Style/BisectedAttrAccessor:
47
- Enabled: true
48
- Style/CaseLikeIf:
49
- Enabled: true
50
- Style/ExplicitBlockArgument:
51
- Enabled: true
52
- Style/ExponentialNotation:
53
- Enabled: true
54
- Style/GlobalStdStream:
55
- Enabled: true
56
- Style/HashAsLastArrayItem:
57
- Enabled: true
58
- Style/HashEachMethods:
59
- Enabled: true
60
- Style/HashLikeCase:
61
- Enabled: true
62
- Style/HashTransformKeys:
63
- Enabled: true
64
- Style/HashTransformValues:
65
- Enabled: true
66
- Style/OptionalBooleanParameter:
67
- Enabled: true
68
- Style/RedundantAssignment:
69
- Enabled: true
70
- Style/RedundantFetchBlock:
71
- Enabled: true
72
- Style/RedundantFileExtensionInRequire:
73
- Enabled: true
74
- Style/RedundantRegexpCharacterClass:
75
- Enabled: true
76
- Style/RedundantRegexpEscape:
77
- Enabled: true
78
- Style/SingleArgumentDig:
79
- Enabled: true
80
- Style/SlicingWithRange:
81
- Enabled: true
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.3
1
+ 2.6.6
data/docs/.envrc ADDED
@@ -0,0 +1,2 @@
1
+ # if you run bundle install --binstubs, you won't have to use bundle exec all the time.
2
+ export PATH=$(git rev-parse --show-toplevel)/docs/bin:$PATH
@@ -2,7 +2,18 @@
2
2
  sort: 4
3
3
  ---
4
4
 
5
- # Code Guidelines
5
+ # Code
6
+
7
+ ## Commit guidelines
8
+
9
+ * The commit log should be a history of small, coherent changes. Commits are cheap, make no attempt
10
+ to minimize the number of them! Yes, it's messy. Yes it makes the commit log longer. It's also far
11
+ more useful than a nice, tidy, one-commit-per-pull-request log.
12
+
13
+ * Follow the existing commit message style. Start with a capitalized, present tense verb and say
14
+ what the commit does. If the reason why isn't obvious, explain in the extended message.
15
+
16
+ ## Code Guidelines
6
17
 
7
18
  * Generally, go for straightforward and readable rather than terse and clever. I'm not actually a
8
19
  very good programmer; I need simple code that's easy to understand.
@@ -31,14 +42,13 @@ criteria:
31
42
  * Maintain "no configuration required" - a new user must be able to add JPT to their gemfile, bundle
32
43
  install, and start writing picture tags in their site without touching a yml file.
33
44
 
34
- * 100% test coverage (Meaning that when running the unit and integration tests together, every line
35
- of code in the `lib` folder must run at least once.)
45
+ * Good test coverage, > 90%. Not every line must be tested, but every line that matters should be.
36
46
 
37
47
  * No failing tests
38
48
 
39
49
  * No rubocop warnings
40
50
 
41
- ### Thanks!
51
+ ## Thanks!
42
52
 
43
53
  As I said, don't let any of the rules & guidelines scare you away. They're the rules for merging
44
54
  into master, not submitting a pull request. I'm thrilled to receive any help at all.
@@ -4,10 +4,28 @@ sort: 2
4
4
 
5
5
  # Docs
6
6
 
7
- They run on github pages, which is based on jekyll. You can preview as you edit:
7
+ The docs are a mini-project in the docs folder. They don't have a dedicated git repository, but they
8
+ do have their own Gemfile. They run on Github Pages, which is based on Jekyll.
8
9
 
9
- 0. Follow the [setup instructions](setup)
10
- 1. `$ cd docs`
11
- 2. `$ bundle install`
12
- 3. `$ bundle exec jekyll serve`
13
- 4. In a web browser, navigate to `localhost:4000/jekyll_picture_tag/`
10
+ The format is simple; markdown files with a few lines of metadata at the top, organized into
11
+ subdirectories. We're using the [jekyll-rtd-theme](https://jekyll-rtd-theme.rundocs.io/).
12
+
13
+ You can preview as you edit; first the setup:
14
+
15
+ ``` sh
16
+ $ git clone git@github.com:rbuchberger/jekyll_picture_tag.git # if you haven't already
17
+ $ cd jekyll_picture_tag/docs
18
+ $ direnv allow # (optional)
19
+ $ bundle install --binstubs # --binstubs is optional.
20
+ ```
21
+
22
+ If you use direnv or add `docs/bin` to your `PATH` another way, the `--binstubs` flag allows you to
23
+ skip `bundle exec`.
24
+
25
+ To preview:
26
+
27
+ ``` sh
28
+ $ jekyll serve --livereload # (prefix with `bundle exec` if necessary)
29
+ ```
30
+
31
+ * In a web browser, navigate to `localhost:4000/jekyll_picture_tag/`
@@ -4,10 +4,30 @@ sort: 1
4
4
 
5
5
  ## Setup
6
6
 
7
- It's pretty standard:
7
+ I use [asdf](https://github.com/asdf-vm/asdf) and [direnv](https://direnv.net/) (via
8
+ [asdf-direnv](https://github.com/asdf-community/asdf-direnv)). They add convenience, but they aren't
9
+ required by any means.
8
10
 
11
+ ### With asdf & direnv:
12
+
13
+ ```sh
14
+ $ git clone git@github.com:rbuchberger/jekyll_picture_tag.git
15
+ $ cd jekyll_picture_tag
16
+ $ direnv allow
17
+ $ asdf install
18
+ $ bundle install --binstubs
9
19
  ```
20
+
21
+ ### Without asdf & direnv
22
+
23
+ ```sh
10
24
  $ git clone git@github.com:rbuchberger/jekyll_picture_tag.git
11
25
  $ cd jekyll_picture_tag
26
+ # Install the correct version of ruby, with the bundler gem.
12
27
  $ bundle install
13
28
  ```
29
+
30
+ * The currently targeted ruby version can be found in the `.ruby-version` file in the project root;
31
+ ensure your version manager of choice knows about it.
32
+ * If you add the project's `bin/` folder to your path, and run `bundle install --binstubs`, you won't
33
+ have to use `bundle exec` for `rake` commands and such.
@@ -2,40 +2,22 @@
2
2
  sort: 3
3
3
  ---
4
4
 
5
- ## How to run the tests
6
-
7
- You probably only need to use docker if it's inconvenient to install ImageMagick 7.
8
-
9
- ### Bare Metal
10
-
11
- ```note
12
- Depending on your environment, you may need to prefix all rake commands with
13
- `bundle exec`.
14
- ```
15
-
16
- `rake test` runs the test suite (both unit tests and integration tests). Ignore the mini_magick
17
- `method redefined` warnings (unless you know how to fix them?)
18
-
19
- `rake unit` runs just the unit tests, while `rake integration` runs the integration tests. The unit
20
- test coverage isn't stellar, but both unit and integration tests together hit 100%.
21
-
22
- Speaking of coverage, simplecov is set up -- you'll get a measurement of coverage in the test output
23
- and a nice report in the `coverage` directory. I'd like to move to mutation based coverage testing,
24
- but that's a project for another day.
25
-
26
- The tests do output a few images to the `/tmp/` directory, which I'm pretty sure means it won't work
27
- on Windows. This is fixable if there is a need, so if that gets in your way just ask.
28
-
29
- `rake rubocop` checks code formatting, `rake rubocop:auto_correct` will try to fix any rubocop
30
- issues, if possible.
31
-
32
- `rake` will run all tests and rubocop.
33
-
34
- ### Docker
35
-
36
- The following commands will build and run the tests inside a docker image.
37
-
38
- ```bash
39
- $ docker build . -t jpt
40
- $ docker run -t jpt
41
- ```
5
+ # Tests
6
+
7
+ The primary way to run these checks is `rake`:
8
+
9
+ | rake command | function |
10
+ |-----------------------------|---------------------------------|
11
+ | `rake unit` | Unit tests only |
12
+ | `rake integration` | Integration tests only |
13
+ | `rake test` | Both unit and integration tests |
14
+ | `rake rubocop` | Check code formatting |
15
+ | `rake rubocop:auto_correct` | Fix rubocop issues, if possible |
16
+ | `rake` | Run all checks |
17
+
18
+ * Ignore the mini_magick `method redefined` warnings (unless you know how to fix them?)
19
+ * Depending on your environment, you may need to prefix all rake commands with `bundle exec`
20
+ * Simplecov is set up -- you'll get a measurement of coverage in the test output and a nice report
21
+ in the `coverage` directory.
22
+ * The tests use the `/tmp/` directory directly, which I'm pretty sure means it won't work on
23
+ Windows. This is fixable, so if that gets in your way just ask.
@@ -1,6 +1,47 @@
1
1
  ---
2
2
  ---
3
3
  # Release History
4
+
5
+ * 2.0.2 March 31, 2021
6
+ * Do not pass a quality argument when generating PNG files.
7
+ * It only works on newer versions of vips, breaking builds when using older
8
+ versions (such as when deploying to netlify.)
9
+ * It's not remarkably useful in the first place.
10
+ * 2.0.1 March 31, 2021
11
+ * Select imagemagick deliberately when appropriate, rather than simply rescuing all vips errors
12
+ and trying again. This will stop JPT from suppressing useful vips errors.
13
+ * **2.0** March 25, 2021 - [Migration guide](/jekyll_picture_tag/users/notes/migration_2)
14
+ * Switch from ImageMagick to libvips.
15
+ * 🚀🔥🔥**MUCH MORE FASTER**🔥🔥🚀
16
+ * Will still attempt to use imagemagick if libvips cannot handle a
17
+ particular image format.
18
+ * Eliminate the ImageMagick v7 on Ubuntu pain we've been dealing with for so
19
+ long.
20
+ * Require Ruby >= 2.6, support Ruby 3.0
21
+ * Require Jekyll >= 4.0
22
+ * Cropping is changing.
23
+ * We now use the libvips
24
+ [smartcrop function](https://www.rubydoc.info/gems/ruby-vips/Vips/Image#smartcrop-instance_method),
25
+ which does some magic to keep the most useful part of the image.
26
+ * Geometry is renamed to 'crop', and reduced to simple aspect ratios only. (`width:height`)
27
+ * Gravity is gone, replaced by 'keep' which is translated to a libvips
28
+ [interestingness](https://www.rubydoc.info/gems/ruby-vips/Vips/Interesting) setting.
29
+ * Add stock presets and media queries, under the `jpt-` prefix.
30
+ * Add `format_quality` default settings for webp, avif, and jp2.
31
+ * Add image-format-specific write options.
32
+ * Overhaul user input handling; we can now validate inputs and give error
33
+ messages which are less useless. Stronger validation and nicer errors will be added in future
34
+ releases.
35
+ * Drop support for `markup_presets` and `media_presets`. They are now
36
+ officially and only `presets` and `media_queries`.
37
+ * Improve docs with an introductory tutorial and 'how-to' flow.
38
+ * 1.14.0 January 10, 2021
39
+ * Gracefully handle empty tag arguments.
40
+ * Re-add metadata stripping. I removed it inadvertently when refactoring; now
41
+ there's a test and a setting to turn it off.
42
+ * Respect Jekyll's `--disable-disk-cache` argument.
43
+ * Add baseurl configuration, allowing increased plugin support (such as I18n via `jekyll-multiple-languages-plugin`)
44
+ * Tooling & test suite maintenance and improvements.
4
45
  * 1.13.0 November 23, 2020
5
46
  * Add image quality interpolation; allows for variable image quality based on image size.
6
47
  * Bugfix: Perform format, resize, and quality changes simultaneously rather than individually.
@@ -49,12 +90,12 @@
49
90
  * link_source will now target the base source image, rather than finding the
50
91
  biggest one.
51
92
  * Remove fastimage dependency, add addressable dependency.
52
- * Moderately significant refactoring and code cleanup
93
+ * Moderately significant refactoring and code cleanup
53
94
  * Decent set of tests added
54
95
  * 1.6.0 Jul 2, 2019:
55
96
  * Missing Preset warning respects `data_dir` setting
56
97
  * Add `continue_on_missing` option
57
- * 1.5.0 Jun 26, 2019:
98
+ * 1.5.0 Jun 26, 2019:
58
99
  * better `{::nomarkdown}` necessity detection
59
100
  * allow user to override `{::nomarkdown}` autodetection
60
101
  * 1.4.0 Jun 26, 2019:
@@ -77,8 +118,8 @@
77
118
  * auto-orient images before stripping metadata
78
119
  * 1.0.2 Jan 18, 2019: Fix ruby version specification
79
120
  * 1.0.1 Jan 13, 2019: Added ruby version checking
80
- * **1.0.0** Nov 27, 2018: Rewrite from the ground up. See the
81
- * [migration guide]({{ site.baseurl }}/users/notes/migration).
121
+ * **1.0.0** Nov 27, 2018: Rewrite from the ground up. See the [migration guide]({{ site.baseurl
122
+ }}/users/notes/migration_1).
82
123
  * 0.2.2 Aug 2, 2013: Bugfixes
83
124
  * 0.2.1 Jul 17, 2013: Refactor again, add Liquid parsing.
84
125
  * 0.2.0 Jul 14, 2013: Rewrite code base, bring in line with Jekyll Image Tag.
data/docs/index.md CHANGED
@@ -1,9 +1,19 @@
1
1
  ---
2
2
  ---
3
3
 
4
- # Jekyll Picture Tag
4
+ ![](logo.svg)
5
5
 
6
- Responsive Images, Done Correctly.
6
+ _Responsive Images, Done Correctly._
7
+
8
+ **Warning:** Deploying JPT can be tricky, especially with the new version using libvips. We depend
9
+ on system libraries to generate images, whose presence varies greatly between different
10
+ environments. Before investing a great deal of time, ensure that your deployment process can handle
11
+ all image formats (both input and output) which you will use.
12
+
13
+ **Note:** These docs are for versions >= 2.0. Documentation for the last stable 1.x version may be
14
+ found by browsing the repository,
15
+ [here](https://github.com/rbuchberger/jekyll_picture_tag/tree/v1.14.0/docs). This [migration
16
+ guide](users/notes/migration_2) documents how to upgrade an existing site.
7
17
 
8
18
  ## Quick start / Demo
9
19
 
@@ -31,17 +41,33 @@ Responsive Images, Done Correctly.
31
41
 
32
42
  ### "That's cool, but I just want webp."
33
43
 
34
- Create `_data/picture.yml`, add the following:
44
+ Use a built-in preset!
35
45
 
36
- ```yml
37
- presets:
38
- default:
39
- formats: [webp, original]
40
- ```
46
+ {% raw %} `{% picture jpt-webp test.jpg %}` {% endraw %}
41
47
 
42
- **Note:** Order matters! `[webp, jpg]` will offer webp-images first. The
43
- browser will pick the *first* format it can work with. So if the order is
44
- reversed `[jpg, webp]` it will use the jpg image before the webp.
48
+ ```html
49
+ <!-- Formatted for readability -->
50
+
51
+ <picture>
52
+ <source
53
+ type="image/webp"
54
+ srcset="
55
+ /generated/test-400-195f7d192.webp 400w,
56
+ /generated/test-600-195f7d192.webp 600w,
57
+ /generated/test-800-195f7d192.webp 800w,
58
+ /generated/test-1000-195f7d192.webp 1000w
59
+ ">
60
+ <source
61
+ type="image/jpeg"
62
+ srcset="
63
+ /generated/test-400-195f7d.jpg 400w,
64
+ /generated/test-600-195f7d.jpg 600w,
65
+ /generated/test-800-195f7d.jpg 800w,
66
+ /generated/test-1000-195f7d.jpg 1000w
67
+ ">
68
+ <img src="/generated/test-800-195f7dGUW.jpg">
69
+ </picture>
70
+ ```
45
71
 
46
72
  ### Here's a more complete demonstration:
47
73
 
@@ -67,9 +93,8 @@ presets:
67
93
  size: 500px
68
94
  ```
69
95
 
70
- Imagemagick can easily crop images to an aspect ratio, though you should **read
71
- the whole installation guide before using this feature**. With the above preset,
72
- if you write this:
96
+ Cropping images is easy as well; simply give an aspect ratio. With the above preset, if you write
97
+ this:
73
98
 
74
99
  {% raw %}
75
100
  `{% picture test.jpg 3:2 mobile: test2.jpg 1:1 --alt Alternate Text %}`
@@ -124,7 +149,7 @@ switching problems *solved*, with a one-liner and a nicely readable config file
124
149
  that is 1/3 as long as the output markup. Lighthouse is happy, and you don't
125
150
  even need to crop things yourself.
126
151
 
127
- That isn't a complete demonstration of Jekyll Picture Tag's feature set; it can
128
- (among other things) add width & height attributes to prevent page reflow, add a
129
- link to the source image (or anywhere else), and adjust image quality. See the
130
- docs for more.
152
+ This is far from a complete demonstration of Jekyll Picture Tag's feature set;
153
+ it can (among other things) add width & height attributes to prevent page
154
+ reflow, add a link to the source image (or anywhere else), and adjust image
155
+ quality. See the docs for more.