jekyll_picture_tag 1.12.0 → 2.0.1
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 +31 -3
- 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 +12 -12
- 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 +24 -25
- 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 +96 -19
- 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/quality_width_graph.png +0 -0
- 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 +11 -10
- 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 +4 -0
- data/lib/jekyll_picture_tag/images/generated_image.rb +92 -0
- data/lib/jekyll_picture_tag/images/image_file.rb +104 -0
- data/lib/jekyll_picture_tag/{img_uri.rb → images/img_uri.rb} +3 -10
- data/lib/jekyll_picture_tag/{source_image.rb → 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 +24 -20
- data/lib/jekyll_picture_tag/version.rb +1 -1
- data/readme.md +46 -15
- metadata +168 -85
- 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/generated_image.rb +0 -140
- data/lib/jekyll_picture_tag/instructions/configuration.rb +0 -121
- data/lib/jekyll_picture_tag/instructions/preset.rb +0 -107
- data/lib/jekyll_picture_tag/instructions/set.rb +0 -75
Binary file
|
@@ -1,19 +1,64 @@
|
|
1
1
|
---
|
2
|
-
sort:
|
2
|
+
sort: 5
|
3
3
|
---
|
4
4
|
|
5
5
|
# Width Based Srcsets
|
6
6
|
|
7
|
-
A width based srcset looks like this:
|
7
|
+
A width based srcset looks like this:
|
8
8
|
|
9
9
|
```html
|
10
10
|
srcset="myimage-800.jpg 800w, myimage-1200.jpg 1200w, myimage-2000.jpg 2000w"
|
11
11
|
```
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
You should use it when the size of an image depends on the size of the screen used to show it, which
|
14
|
+
generally means anything bigger than about 300 pixels. It's the default; to use it specify a
|
15
|
+
`widths` setting (or don't, for the default set), and optionally the `sizes` and `size` settings.
|
15
16
|
|
16
|
-
##
|
17
|
+
## A word on sizes
|
18
|
+
|
19
|
+
The `sizes` attribute is both important, and impossible to offer good defaults for. Web browsers parse
|
20
|
+
web pages line-by-line. When they run into an external asset (such as an image) they must download,
|
21
|
+
they start that process immediately without waiting to draw the page. This means that at the point
|
22
|
+
in time when the browser must decide which image to download, it has no clue how large that image
|
23
|
+
will be on the page. The sizes attribute is how we tell it.
|
24
|
+
|
25
|
+
It doesn't have to be pixel-perfect, just close enough for the browser to make a good choice. You
|
26
|
+
can't use % (percentage width of the parent container) for the same reason we have to do this at
|
27
|
+
all. If you do not provide it, the web browser will assume the image is 100vw (100% the width of
|
28
|
+
the viewport.)
|
29
|
+
|
30
|
+
## How to create a sizes attribute
|
31
|
+
|
32
|
+
First, Load the page and image as they will appear in the final site. (Basically write the rest of
|
33
|
+
the preset.)
|
34
|
+
|
35
|
+
Next, using either dev tools or by manipulating the browser window itself, determine how large the
|
36
|
+
image will be for all reasonable screen sizes. Organize this information into CSS measurements
|
37
|
+
(using `vw`, `vh`, `px`, `em`, or a calculation based on those units) associated with your
|
38
|
+
named CSS media queries, and enter them into the relevant preset. **Order matters**; enter these
|
39
|
+
from most to least restrictive. The browser will ignore everything after the first media query it
|
40
|
+
finds that is true.
|
41
|
+
|
42
|
+
**Example:** on my particular site, for screens 900px or smaller, inline images are the width of the
|
43
|
+
viewport minus 9px of padding on either side. For screens 901px or larger, they are a constant 862px
|
44
|
+
wide. The relevant lines in my config file look like this:
|
45
|
+
|
46
|
+
```yml
|
47
|
+
media_queries:
|
48
|
+
full_width: 'min-width: 901px'
|
49
|
+
# (...)
|
50
|
+
|
51
|
+
presets:
|
52
|
+
default:
|
53
|
+
# (...)
|
54
|
+
sizes:
|
55
|
+
full_width: 862px
|
56
|
+
size: calc(100vw - 18px)
|
57
|
+
```
|
58
|
+
|
59
|
+
## Settings Reference
|
60
|
+
|
61
|
+
### Widths
|
17
62
|
|
18
63
|
_Format:_ `widths: [integer, integer, (...)]`
|
19
64
|
|
@@ -23,7 +68,7 @@ _Default_: `[400, 600, 800, 1000]`
|
|
23
68
|
|
24
69
|
Array of image widths to generate, in pixels.
|
25
70
|
|
26
|
-
|
71
|
+
### Media Widths
|
27
72
|
|
28
73
|
_Format:_
|
29
74
|
|
@@ -41,11 +86,11 @@ media_widths:
|
|
41
86
|
|
42
87
|
_Default:_ `widths` setting
|
43
88
|
|
44
|
-
If you are using art direction, there is no sense in generating desktop-size
|
45
|
-
|
46
|
-
|
89
|
+
If you are using art direction, there is no sense in generating desktop-size files for your mobile
|
90
|
+
image. Similarly, there's no sense in generating 300px wide versions of your ultrawide crop. You can
|
91
|
+
specify sets of widths to associate with given media queries.
|
47
92
|
|
48
|
-
|
93
|
+
### Sizes
|
49
94
|
|
50
95
|
_Format:_
|
51
96
|
|
@@ -64,22 +109,15 @@ sizes:
|
|
64
109
|
desktop: 900px
|
65
110
|
```
|
66
111
|
|
67
|
-
Conditional sizes, used to construct the `sizes=` HTML attribute telling the
|
68
|
-
|
69
|
-
|
70
|
-
with
|
71
|
-
|
72
|
-
Provide these in order of most restrictive to least restrictive. The browser
|
73
|
-
will choose the first one with an applicable media query.
|
74
|
-
|
75
|
-
You don't have to provide a sizes attribute at all. If you don't, the browser
|
76
|
-
will assume the image is 100% the width of the viewport.
|
112
|
+
Conditional sizes, used to construct the `sizes=` HTML attribute telling the browser how wide your
|
113
|
+
image will be (on the screen) when a given media query is true. CSS dimensions can be given in `px`,
|
114
|
+
`em`, or `vw`. Provide these in order of most restrictive to least restrictive. The browser will
|
115
|
+
choose the first one with an applicable media query.
|
77
116
|
|
78
|
-
|
117
|
+
### Size
|
79
118
|
|
80
119
|
_Format:_ `size: (CSS Dimension)`
|
81
120
|
|
82
121
|
_Example:_ `size: 80vw`
|
83
122
|
|
84
|
-
Unconditional `sizes` setting, to be supplied either alone or after all
|
85
|
-
conditional sizes.
|
123
|
+
Unconditional `sizes` setting, to be supplied either alone or after all conditional sizes.
|
@@ -0,0 +1,65 @@
|
|
1
|
+
---
|
2
|
+
sort: 1
|
3
|
+
---
|
4
|
+
|
5
|
+
# How to write a preset
|
6
|
+
|
7
|
+
## 0. Pick a name
|
8
|
+
|
9
|
+
* Preset names should be a single word, and they can't contain periods.
|
10
|
+
* `default` is used when you don't specify one in a liquid tag.
|
11
|
+
* Anything beginning with `jpt-` is off limits.
|
12
|
+
|
13
|
+
## 1. Pick a Markup Format
|
14
|
+
|
15
|
+
The high level, overall markup format is controlled with the `markup:` setting, documented
|
16
|
+
[here](markup_formats). You probably want the default setting of `auto`, unless you're doing some
|
17
|
+
form of post-processing.
|
18
|
+
|
19
|
+
If you have a lot of images below-the-fold, consider setting up lazy-loading with an appropriate
|
20
|
+
javascript library (there are tons) and `data_auto`.
|
21
|
+
|
22
|
+
## 2. Choose a srcset format.
|
23
|
+
|
24
|
+
For images that are different sizes on different screens (most images), use a [width-based
|
25
|
+
srcset](width_srcsets) (which is the default). When using this format, it's important to create a
|
26
|
+
sizes attribute, documented at the link above.
|
27
|
+
|
28
|
+
Use a [pixel-ratio srcset](pixel_ratio_srcsets) when the image will always be the same size,
|
29
|
+
regardless of screen width (thumbnails, avatars, icons, etc).
|
30
|
+
|
31
|
+
## 3. Choose a set of image widths.
|
32
|
+
|
33
|
+
For width-based srcsets, set `widths:`. For pixel-ratio srcsets, set `base_width:` and
|
34
|
+
`pixel_ratios:`. You want 3-6 sizes that cover a wide range of devices.
|
35
|
+
|
36
|
+
## 4. Choose a set of image formats.
|
37
|
+
|
38
|
+
Accomplish this by setting `formats: [format1, format2, etc...]`
|
39
|
+
|
40
|
+
* `webp` has [broad support](https://caniuse.com/?search=webp) and is an obvious choice.
|
41
|
+
* `avif` has [bad](https://caniuse.com/?search=avif) (but improving) support, and for some reason is slow to generate, but gets better
|
42
|
+
file sizes than webp.
|
43
|
+
* `jp2` is [Apple's baby](https://caniuse.com/?search=jp2).
|
44
|
+
* `original` spits out whatever you put in.
|
45
|
+
|
46
|
+
Order matters; browsers will use the first one they support.
|
47
|
+
|
48
|
+
* `[webp, original]` is a good compromise of build resources, support, and performance.
|
49
|
+
* `[webp, jp2, original]` brings Safari users along for the ride.
|
50
|
+
* `[avif, original]` If you don't care about browsers that aren't chrome, or build time.
|
51
|
+
* `[avif, webp, jp2, original]` might be overkill, but it keeps everyone happy.
|
52
|
+
|
53
|
+
## 5. Consider enabling dimension attributes.
|
54
|
+
|
55
|
+
This step prevents page reflow on image load (especially when lazy loading), but requires some prep.
|
56
|
+
|
57
|
+
1. Make sure your CSS is correct. You need something like `width: 100%` and `height: auto` (which
|
58
|
+
is why they aren't turned on by default.) Without this step, you'll get crazy sizes and/or
|
59
|
+
stretched images.
|
60
|
+
2. Set `dimension_attributes: true`
|
61
|
+
|
62
|
+
## 6. Make any other necessary changes.
|
63
|
+
|
64
|
+
Look through the options in the sidebar to the left, adjust as required. Note that the `data_*`
|
65
|
+
output formats have a few special options, documented on their respective pages.
|
@@ -0,0 +1,97 @@
|
|
1
|
+
---
|
2
|
+
sort: 3
|
3
|
+
---
|
4
|
+
|
5
|
+
# Tutorial
|
6
|
+
|
7
|
+
## Hello, world!
|
8
|
+
|
9
|
+
Once you've followed the [installation](installation) instructions, it's a good
|
10
|
+
time to make sure we're set up correctly. Drop an image or two in the site root
|
11
|
+
(or `source` directory if you [configured it](configuration/directories)), pick
|
12
|
+
some page and write the following (substitute the image filename as
|
13
|
+
appropriate):
|
14
|
+
|
15
|
+
{% raw %}
|
16
|
+
```
|
17
|
+
{% picture my_image.jpg %}
|
18
|
+
```
|
19
|
+
{% endraw %}
|
20
|
+
|
21
|
+
Build/serve the site and check it out! Your image should be there, and if you inspect it with the
|
22
|
+
dev tools you should see an `<img>` tag with a `srcset` attribute. You're officially serving
|
23
|
+
responsive images.
|
24
|
+
|
25
|
+
## Webp
|
26
|
+
|
27
|
+
JPT includes several built-in presets and media queries, documented in the
|
28
|
+
[examples](presets/examples). They're intended as a starting point and a learning tool, not for
|
29
|
+
production use. Don't dig to deeply into that link just yet, try them out first:
|
30
|
+
|
31
|
+
{% raw %}
|
32
|
+
```
|
33
|
+
{% picture jpt-webp my_image.jpg %}
|
34
|
+
```
|
35
|
+
{% endraw %}
|
36
|
+
|
37
|
+
Now instead of a lone `<img>` tag, you get a `<picture>` surrounding two `<source>`s and an `<img>`.
|
38
|
+
The first source contains webp images, and the second contains jpgs. Success! Lighthouse is happier
|
39
|
+
and happier.
|
40
|
+
|
41
|
+
## Alt text
|
42
|
+
|
43
|
+
Good web developers add alt text. JPT makes this easy:
|
44
|
+
|
45
|
+
{% raw %}
|
46
|
+
```
|
47
|
+
{% picture my_image.jpg --alt Happy Puppy %}
|
48
|
+
```
|
49
|
+
{% endraw %}
|
50
|
+
|
51
|
+
## Crop
|
52
|
+
|
53
|
+
|
54
|
+
{% raw %}
|
55
|
+
```
|
56
|
+
{% picture my_image.jpg 16:9 %}
|
57
|
+
```
|
58
|
+
{% endraw %}
|
59
|
+
|
60
|
+
Feeling cinematic? If you don't like how the image gets cropped, you can adjust it:
|
61
|
+
|
62
|
+
{% raw %}
|
63
|
+
```
|
64
|
+
{% picture my_image.jpg 16:9 center %}
|
65
|
+
```
|
66
|
+
{% endraw %}
|
67
|
+
|
68
|
+
Your options are `attention` (which is the default), `entropy`, and `center`.
|
69
|
+
|
70
|
+
## Art Direction
|
71
|
+
|
72
|
+
(Usually means "Cropping, but only sometimes.")
|
73
|
+
|
74
|
+
Art direction is tricky to understand; I know it tripped me up for awhile when learning the subject.
|
75
|
+
Here's a short explanation, along with a demo: Let's pretend that we have some image which looks
|
76
|
+
good on desktop, but on a mobile screen it's hard to see the subject. Resolution isn't the problem,
|
77
|
+
the image just needs to be cropped for smaller screens. JPT makes this easy:
|
78
|
+
|
79
|
+
{% raw %}
|
80
|
+
```
|
81
|
+
{% picture my_image.jpg 2:1 jpt-mobile: my_image.jpg 1:1 %}
|
82
|
+
```
|
83
|
+
{% endraw %}
|
84
|
+
|
85
|
+
This tag is pretty complicated, so here's a breakdown in plain english:
|
86
|
+
* Use the default preset.
|
87
|
+
* use my_image.jpg as the base image.
|
88
|
+
* Crop it to a 2:1 aspect ratio.
|
89
|
+
* When the media query named 'jpt-mobile' is true, also use my_image.jpg
|
90
|
+
* but this time crop it square.
|
91
|
+
|
92
|
+
Now adjust the browser width. When skinny, you should see a square crop of your image, and when it's
|
93
|
+
wide you should see a 2:1 crop of the same image. That's art direction. Note that there's no
|
94
|
+
requirement at all for them to be the same image, and you don't have to use JPT to do the cropping.
|
95
|
+
|
96
|
+
There are several more liquid tag examples [here](liquid_tag/examples) that you may want to look
|
97
|
+
over, as well as the [liquid tag instructions](liquid_tag).
|
data/jekyll_picture_tag.gemspec
CHANGED
@@ -4,43 +4,58 @@ require 'jekyll_picture_tag/version'
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'jekyll_picture_tag'
|
7
|
-
spec.version = PictureTag::VERSION
|
8
7
|
spec.authors = ['Robert Wierzbowski', 'Brendan Tobolaski',
|
9
8
|
'Robert Buchberger']
|
10
9
|
spec.email = ['robert@buchberger.cc']
|
11
|
-
|
10
|
+
spec.homepage = 'https://github.com/rbuchberger/jekyll_picture_tag'
|
11
|
+
spec.metadata = { 'documentation_uri' =>
|
12
|
+
'https://rbuchberger.github.io/jekyll_picture_tag/' }
|
13
|
+
spec.license = 'BSD-3-Clause'
|
12
14
|
spec.summary = 'Easy responsive images for Jekyll.'
|
13
15
|
spec.description = <<-HEREDOC
|
14
|
-
Jekyll Picture Tag
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
simple template tag.
|
16
|
+
Jekyll Picture Tag adds responsive images to your Jekyll static site. It
|
17
|
+
automatically creates resized source images, is fully configurable, and
|
18
|
+
covers all use cases, including art direction and resolution switching, with
|
19
|
+
a little YAML configuration and a simple template tag.
|
19
20
|
HEREDOC
|
20
|
-
spec.homepage = 'https://github.com/rbuchberger/jekyll_picture_tag'
|
21
|
-
spec.license = 'BSD-3-Clause'
|
22
|
-
spec.require_paths = ['lib']
|
23
21
|
|
22
|
+
spec.version = PictureTag::VERSION
|
23
|
+
spec.require_paths = ['lib']
|
24
24
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
25
|
-
f.match(%r{^(test
|
25
|
+
f.match(%r{^(test)/})
|
26
26
|
end
|
27
27
|
|
28
|
-
spec.required_ruby_version = ['>= 2.
|
28
|
+
spec.required_ruby_version = ['>= 2.6', '< 4.0']
|
29
|
+
|
30
|
+
# addressable is used to url-encode image filenames.
|
31
|
+
spec.add_runtime_dependency 'addressable', '~> 2.6'
|
32
|
+
# Jekyll versions older than 4.0 are not supported.
|
33
|
+
spec.add_runtime_dependency 'jekyll', '~> 4.0'
|
34
|
+
# MIME types are needed for <source> tags' type= attributes.
|
35
|
+
spec.add_runtime_dependency 'mime-types', '~> 3.0'
|
36
|
+
# objective_elements handles HTML generation.
|
37
|
+
spec.add_runtime_dependency 'objective_elements', '~> 1.1'
|
38
|
+
# rainbow is used to colorize terminal output.
|
39
|
+
spec.add_runtime_dependency 'rainbow', '~> 3.0'
|
40
|
+
# ruby-vips interfaces with libvips.
|
41
|
+
spec.add_runtime_dependency 'ruby-vips', '~> 2.0.17'
|
29
42
|
|
43
|
+
# libvips handles all image processing operations.
|
44
|
+
spec.requirements << 'libvips'
|
45
|
+
|
46
|
+
# Development dependencies are not installed when using this gem. You can
|
47
|
+
# ignore these, unless you are working on JPT itself.
|
30
48
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
31
|
-
spec.add_development_dependency 'minitest', '~> 5.
|
49
|
+
spec.add_development_dependency 'minitest', '~> 5.14'
|
50
|
+
spec.add_development_dependency 'minitest-rg'
|
32
51
|
spec.add_development_dependency 'mocha', '~> 1.9'
|
33
|
-
spec.add_development_dependency 'nokogiri', '~> 1.
|
52
|
+
spec.add_development_dependency 'nokogiri', '~> 1.1'
|
34
53
|
spec.add_development_dependency 'pry'
|
35
54
|
spec.add_development_dependency 'rake', '~> 12.3'
|
36
|
-
spec.add_development_dependency 'rubocop'
|
37
|
-
spec.add_development_dependency '
|
55
|
+
spec.add_development_dependency 'rubocop', '~> 1.7.0'
|
56
|
+
spec.add_development_dependency 'rubocop-minitest', '~> 0.10.0'
|
57
|
+
spec.add_development_dependency 'rubocop-performance', '~> 1.9.0'
|
58
|
+
spec.add_development_dependency 'rubocop-rake', '~> 0.5.0'
|
59
|
+
spec.add_development_dependency 'simplecov', '~> 0.20.0'
|
38
60
|
spec.add_development_dependency 'solargraph'
|
39
|
-
|
40
|
-
spec.add_dependency 'addressable', '~> 2.6'
|
41
|
-
spec.add_dependency 'mime-types', '~> 3'
|
42
|
-
spec.add_dependency 'mini_magick', '~> 4'
|
43
|
-
spec.add_dependency 'objective_elements', '~> 1.1.2'
|
44
|
-
|
45
|
-
spec.add_runtime_dependency 'jekyll', '< 5'
|
46
61
|
end
|
data/lib/jekyll_picture_tag.rb
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
require 'jekyll'
|
2
2
|
require 'objective_elements'
|
3
3
|
|
4
|
-
require_relative 'jekyll_picture_tag/
|
4
|
+
require_relative 'jekyll_picture_tag/cache'
|
5
|
+
require_relative 'jekyll_picture_tag/images'
|
5
6
|
require_relative 'jekyll_picture_tag/instructions'
|
6
7
|
require_relative 'jekyll_picture_tag/output_formats'
|
7
|
-
require_relative 'jekyll_picture_tag/
|
8
|
+
require_relative 'jekyll_picture_tag/parsers'
|
9
|
+
require_relative 'jekyll_picture_tag/router'
|
8
10
|
require_relative 'jekyll_picture_tag/srcsets'
|
9
11
|
require_relative 'jekyll_picture_tag/utils'
|
10
|
-
require_relative 'jekyll_picture_tag/
|
11
|
-
require_relative 'jekyll_picture_tag/
|
12
|
-
require_relative 'jekyll_picture_tag/cache'
|
12
|
+
require_relative 'jekyll_picture_tag/defaults/presets'
|
13
|
+
require_relative 'jekyll_picture_tag/defaults/global'
|
13
14
|
|
14
15
|
# Title: Jekyll Picture Tag
|
15
16
|
# Authors: Rob Wierzbowski : @robwierzbowski
|
@@ -62,7 +63,9 @@ module PictureTag
|
|
62
63
|
def render(context)
|
63
64
|
setup(context)
|
64
65
|
|
65
|
-
if PictureTag.disabled?
|
66
|
+
if PictureTag.disabled? || PictureTag.raw_params.empty?
|
67
|
+
Utils.warning 'You have called JPT without any arguments.'
|
68
|
+
|
66
69
|
''
|
67
70
|
else
|
68
71
|
PictureTag.output_class.new.to_s
|
@@ -72,11 +75,9 @@ module PictureTag
|
|
72
75
|
private
|
73
76
|
|
74
77
|
def setup(context)
|
78
|
+
PictureTag.clear_instructions
|
75
79
|
PictureTag.context = context
|
76
|
-
|
77
|
-
# Now that we have both the tag parameters and the context object, we can
|
78
|
-
# build our instruction set.
|
79
|
-
PictureTag.instructions = Instructions::Set.new(@raw_params)
|
80
|
+
PictureTag.raw_params = @raw_params
|
80
81
|
|
81
82
|
# We need to explicitly prevent jekyll from overwriting our generated
|
82
83
|
# image files:
|