jekyll_picture_tag 2.0.0 → 2.0.1
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/docs/devs/releases.md +3 -0
- data/docs/index.md +5 -0
- data/docs/users/deployment.md +49 -0
- data/lib/jekyll_picture_tag/images/image_file.rb +22 -8
- data/lib/jekyll_picture_tag/instructions/children/parsers.rb +7 -0
- data/lib/jekyll_picture_tag/parsers.rb +1 -0
- data/lib/jekyll_picture_tag/parsers/image_backend.rb +33 -0
- data/lib/jekyll_picture_tag/version.rb +1 -1
- data/readme.md +29 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d6d2bf0edc139d12f269e614e3585ecf18ace2a48a92e9bc1367a6e654ba2d0
|
4
|
+
data.tar.gz: e6fe2197c58c368255472631adeef9dd9a593230c7655617ad66d00330ba4b4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8682488670153d69640703aa1cd128f57be84c979efff085d19144e4861c3a7d854ae9d638e766ce2398ccafec68b9243613b65b2186e51c83a3d89ef9bc3c9d
|
7
|
+
data.tar.gz: 631adc8189614973ab8ad6b14c2b08fd335abcf53cf8a7b6b63cd23f66bcfb9e5f2c800e188b0eeee46242d2a409db776ec5ad64bae0df4fd7c7ca4694429e49
|
data/docs/devs/releases.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
---
|
2
2
|
---
|
3
3
|
# Release History
|
4
|
+
* 2.0.1 March 31, 2021
|
5
|
+
* Select imagemagick deliberately when appropriate, rather than simply rescuing all vips errors
|
6
|
+
and trying again. This will stop JPT from suppressing useful vips errors.
|
4
7
|
* **2.0** March 25, 2021 - [Migration guide](/jekyll_picture_tag/users/notes/migration_2)
|
5
8
|
* Switch from ImageMagick to libvips.
|
6
9
|
* 🚀🔥🔥**MUCH MORE FASTER**🔥🔥🚀
|
data/docs/index.md
CHANGED
@@ -5,6 +5,11 @@
|
|
5
5
|
|
6
6
|
_Responsive Images, Done Correctly._
|
7
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
|
+
|
8
13
|
**Note:** These docs are for versions >= 2.0. Documentation for the last stable 1.x version may be
|
9
14
|
found by browsing the repository,
|
10
15
|
[here](https://github.com/rbuchberger/jekyll_picture_tag/tree/v1.14.0/docs). This [migration
|
@@ -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.)
|
@@ -2,6 +2,15 @@ module PictureTag
|
|
2
2
|
# Basically a wrapper class for vips. Handles image operations.
|
3
3
|
# Vips returns new images for Crop, resize, and autorotate operations.
|
4
4
|
# Quality, metadata stripping, and format are applied on write.
|
5
|
+
#
|
6
|
+
# This deserves to be two classes and a factory, one for normal vips save and
|
7
|
+
# one for magicksave. This is illustrated by the fact that stubbing backend
|
8
|
+
# determination logic for its unit tests would basically require
|
9
|
+
# re-implementing it completely.
|
10
|
+
#
|
11
|
+
# I'm planning to implement standalone imagemagick as an alternative to vips,
|
12
|
+
# so when I add that I'll also do that refactoring. For now it works fine and
|
13
|
+
# it's not too bloated.
|
5
14
|
class ImageFile
|
6
15
|
def initialize(source, base)
|
7
16
|
@source = source
|
@@ -35,13 +44,21 @@ module PictureTag
|
|
35
44
|
image.autorot
|
36
45
|
end
|
37
46
|
|
47
|
+
def handler
|
48
|
+
PictureTag.backend.handler_for(@base.format)
|
49
|
+
end
|
50
|
+
|
51
|
+
def quality_key
|
52
|
+
handler == :vips ? :Q : :quality
|
53
|
+
end
|
54
|
+
|
38
55
|
def write_opts
|
39
56
|
opts = PictureTag.preset['image_options'][@base.format] || {}
|
40
57
|
|
41
58
|
opts[:strip] = PictureTag.preset['strip_metadata']
|
42
59
|
|
43
60
|
# gifs don't accept a quality setting.
|
44
|
-
opts[
|
61
|
+
opts[quality_key] = base.quality unless base.format == 'gif'
|
45
62
|
|
46
63
|
opts.transform_keys(&:to_sym)
|
47
64
|
end
|
@@ -51,15 +68,12 @@ module PictureTag
|
|
51
68
|
end
|
52
69
|
|
53
70
|
def write(image)
|
54
|
-
|
71
|
+
case handler
|
72
|
+
when :vips
|
55
73
|
image.write_to_file(base.absolute_filename, **write_opts)
|
56
|
-
rescue Vips::Error
|
57
74
|
# If vips can't handle it, fall back to imagemagick.
|
58
|
-
|
59
|
-
|
60
|
-
end
|
61
|
-
|
62
|
-
image.magicksave(base.absolute_filename, **opts)
|
75
|
+
when :magick
|
76
|
+
image.magicksave(base.absolute_filename, **write_opts)
|
63
77
|
end
|
64
78
|
|
65
79
|
# Fix permissions. TODO - still necessary?
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module PictureTag
|
2
|
+
module Parsers
|
3
|
+
# Returns information regarding image handlers
|
4
|
+
class ImageBackend
|
5
|
+
def handler_for(format)
|
6
|
+
if vips_formats.include? format
|
7
|
+
:vips
|
8
|
+
elsif magick_formats.include? format
|
9
|
+
:magick
|
10
|
+
else
|
11
|
+
raise "No support for generating #{format} files in this environment."
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# Returns array of formats that vips can save to
|
16
|
+
def vips_formats
|
17
|
+
@vips_formats ||= `vips -l filesave`
|
18
|
+
.scan(/\.[a-z]{1,5}/)
|
19
|
+
.uniq
|
20
|
+
.map { |format| format.strip.delete_prefix('.') }
|
21
|
+
end
|
22
|
+
|
23
|
+
# Returns an array of formats that imagemagick can handle.
|
24
|
+
def magick_formats
|
25
|
+
@magick_formats ||= `convert -version`
|
26
|
+
.split("\n")
|
27
|
+
.last
|
28
|
+
.delete_prefix('Delegates (built-in):')
|
29
|
+
.split
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/readme.md
CHANGED
@@ -47,6 +47,35 @@ https://rbuchberger.github.io/jekyll_picture_tag/devs/releases
|
|
47
47
|
|
48
48
|
Recent releases:
|
49
49
|
|
50
|
+
* 2.0.1 March 31, 2021
|
51
|
+
* Select imagemagick deliberately when appropriate, rather than simply rescuing all vips errors
|
52
|
+
and trying again. This will stop JPT from suppressing useful vips errors.
|
53
|
+
* **2.0** March 25, 2021 - [Migration guide](https://rbuchberger.github.io/jekyll_picture_tag/users/notes/migration_2)
|
54
|
+
* Switch from ImageMagick to libvips.
|
55
|
+
* 🚀🔥🔥**MUCH MORE FASTER**🔥🔥🚀
|
56
|
+
* Will still attempt to use imagemagick if libvips cannot handle a
|
57
|
+
particular image format.
|
58
|
+
* Eliminate the ImageMagick v7 on Ubuntu pain we've been dealing with for so
|
59
|
+
long.
|
60
|
+
* Require Ruby >= 2.6, support Ruby 3.0
|
61
|
+
* Require Jekyll >= 4.0
|
62
|
+
* Cropping is changing.
|
63
|
+
* We now use the libvips
|
64
|
+
[smartcrop function](https://www.rubydoc.info/gems/ruby-vips/Vips/Image#smartcrop-instance_method),
|
65
|
+
which does some magic to keep the most useful part of the image.
|
66
|
+
* Geometry is renamed to 'crop', and reduced to simple aspect ratios only. (`width:height`)
|
67
|
+
* Gravity is gone, replaced by 'keep' which is translated to a libvips
|
68
|
+
[interestingness](https://www.rubydoc.info/gems/ruby-vips/Vips/Interesting) setting.
|
69
|
+
* Add stock presets and media queries, under the `jpt-` prefix.
|
70
|
+
* Add `format_quality` default settings for webp, avif, and jp2.
|
71
|
+
* Add image-format-specific write options.
|
72
|
+
* Overhaul user input handling; we can now validate inputs and give error
|
73
|
+
messages which are less useless. Stronger validation and nicer errors will be added in future
|
74
|
+
releases.
|
75
|
+
* Drop support for `markup_presets` and `media_presets`. They are now
|
76
|
+
officially and only `presets` and `media_queries`.
|
77
|
+
* Improve docs with an introductory tutorial and 'how-to' flow.
|
78
|
+
|
50
79
|
* 1.14.0 January 10, 2021
|
51
80
|
* Gracefully handle empty tag arguments.
|
52
81
|
* Re-add metadata stripping. I removed it inadvertently when refactoring; now
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll_picture_tag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Wierzbowski
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-03-
|
13
|
+
date: 2021-03-31 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: addressable
|
@@ -320,6 +320,7 @@ files:
|
|
320
320
|
- docs/users/configuration/kramdown_fix.md
|
321
321
|
- docs/users/configuration/suppress_warnings.md
|
322
322
|
- docs/users/configuration/urls.md
|
323
|
+
- docs/users/deployment.md
|
323
324
|
- docs/users/getting_started.md
|
324
325
|
- docs/users/index.md
|
325
326
|
- docs/users/installation.md
|
@@ -395,6 +396,7 @@ files:
|
|
395
396
|
- lib/jekyll_picture_tag/parsers/arg_splitter.rb
|
396
397
|
- lib/jekyll_picture_tag/parsers/configuration.rb
|
397
398
|
- lib/jekyll_picture_tag/parsers/html_attributes.rb
|
399
|
+
- lib/jekyll_picture_tag/parsers/image_backend.rb
|
398
400
|
- lib/jekyll_picture_tag/parsers/preset.rb
|
399
401
|
- lib/jekyll_picture_tag/parsers/tag_parser.rb
|
400
402
|
- lib/jekyll_picture_tag/router.rb
|