jekyll_picture_tag 1.7.0 → 1.7.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/.gitignore +3 -0
- data/.solargraph.yml +15 -0
- data/docs/Gemfile +4 -0
- data/docs/Gemfile.lock +154 -0
- data/docs/_config.yml +13 -0
- data/docs/_layouts/directory.html +32 -0
- data/docs/assets/style.css +31 -0
- data/{contributing.md → docs/contributing.md} +18 -10
- data/docs/{examples/_data/picture.yml → example_presets.md} +35 -24
- data/docs/global_configuration.md +6 -1
- data/docs/index.md +108 -0
- data/docs/installation.md +22 -22
- data/docs/migration.md +4 -0
- data/docs/notes.md +57 -61
- data/docs/output.md +52 -0
- data/docs/presets.md +79 -180
- data/docs/releases.md +49 -0
- data/docs/usage.md +59 -77
- data/jekyll_picture_tag.gemspec +2 -1
- data/lib/jekyll_picture_tag/instructions/html_attributes.rb +14 -8
- data/lib/jekyll_picture_tag/version.rb +1 -1
- data/readme.md +14 -192
- metadata +29 -9
- data/docs/examples/_config.yml +0 -10
- data/docs/examples/post.md +0 -46
- data/docs/readme.md +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62e94c65637b912d5e44da1f3d0a9dac3c2ec8a9f8e538ebac99e2560a348356
|
4
|
+
data.tar.gz: c845a01518248c1f77fbcdb115546627803e7be27516149e717e09edd07dc75e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f322901c3b54fe9a4564ca480be283bdde4a68e1da505fbe309671546f551686a01f9c03dfa5159a14754f53791e342700f35e33cb7a0b71577ea2e86e282a75
|
7
|
+
data.tar.gz: 251b9ed64c11dd6e4a460151703234c80d1d0f4bbd6c05f8fda412a7404bf7c8193e65761b5aac6633628e9bec49c587b8fd53dee1961b7a82c0f04d68435fb8
|
data/.gitignore
CHANGED
data/.solargraph.yml
ADDED
data/docs/Gemfile
ADDED
data/docs/Gemfile.lock
ADDED
@@ -0,0 +1,154 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (4.2.7)
|
5
|
+
i18n (~> 0.7)
|
6
|
+
json (~> 1.7, >= 1.7.7)
|
7
|
+
minitest (~> 5.1)
|
8
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
9
|
+
tzinfo (~> 1.1)
|
10
|
+
addressable (2.4.0)
|
11
|
+
coffee-script (2.4.1)
|
12
|
+
coffee-script-source
|
13
|
+
execjs
|
14
|
+
coffee-script-source (1.12.2)
|
15
|
+
colorator (1.1.0)
|
16
|
+
concurrent-ruby (1.1.5)
|
17
|
+
ethon (0.12.0)
|
18
|
+
ffi (>= 1.3.0)
|
19
|
+
execjs (2.7.0)
|
20
|
+
faraday (0.15.4)
|
21
|
+
multipart-post (>= 1.2, < 3)
|
22
|
+
ffi (1.11.1)
|
23
|
+
forwardable-extended (2.6.0)
|
24
|
+
gemoji (2.1.0)
|
25
|
+
github-pages (104)
|
26
|
+
activesupport (= 4.2.7)
|
27
|
+
github-pages-health-check (= 1.2.0)
|
28
|
+
jekyll (= 3.3.0)
|
29
|
+
jekyll-avatar (= 0.4.2)
|
30
|
+
jekyll-coffeescript (= 1.0.1)
|
31
|
+
jekyll-feed (= 0.8.0)
|
32
|
+
jekyll-gist (= 1.4.0)
|
33
|
+
jekyll-github-metadata (= 2.2.0)
|
34
|
+
jekyll-mentions (= 1.2.0)
|
35
|
+
jekyll-paginate (= 1.1.0)
|
36
|
+
jekyll-redirect-from (= 0.11.0)
|
37
|
+
jekyll-sass-converter (= 1.3.0)
|
38
|
+
jekyll-seo-tag (= 2.1.0)
|
39
|
+
jekyll-sitemap (= 0.12.0)
|
40
|
+
jekyll-swiss (= 0.4.0)
|
41
|
+
jemoji (= 0.7.0)
|
42
|
+
kramdown (= 1.11.1)
|
43
|
+
liquid (= 3.0.6)
|
44
|
+
listen (= 3.0.6)
|
45
|
+
mercenary (~> 0.3)
|
46
|
+
minima (= 2.0.0)
|
47
|
+
rouge (= 1.11.1)
|
48
|
+
terminal-table (~> 1.4)
|
49
|
+
github-pages-health-check (1.2.0)
|
50
|
+
addressable (~> 2.3)
|
51
|
+
net-dns (~> 0.8)
|
52
|
+
octokit (~> 4.0)
|
53
|
+
public_suffix (~> 1.4)
|
54
|
+
typhoeus (~> 0.7)
|
55
|
+
html-pipeline (2.12.0)
|
56
|
+
activesupport (>= 2)
|
57
|
+
nokogiri (>= 1.4)
|
58
|
+
i18n (0.9.5)
|
59
|
+
concurrent-ruby (~> 1.0)
|
60
|
+
jekyll (3.3.0)
|
61
|
+
addressable (~> 2.4)
|
62
|
+
colorator (~> 1.0)
|
63
|
+
jekyll-sass-converter (~> 1.0)
|
64
|
+
jekyll-watch (~> 1.1)
|
65
|
+
kramdown (~> 1.3)
|
66
|
+
liquid (~> 3.0)
|
67
|
+
mercenary (~> 0.3.3)
|
68
|
+
pathutil (~> 0.9)
|
69
|
+
rouge (~> 1.7)
|
70
|
+
safe_yaml (~> 1.0)
|
71
|
+
jekyll-avatar (0.4.2)
|
72
|
+
jekyll (~> 3.0)
|
73
|
+
jekyll-coffeescript (1.0.1)
|
74
|
+
coffee-script (~> 2.2)
|
75
|
+
jekyll-feed (0.8.0)
|
76
|
+
jekyll (~> 3.3)
|
77
|
+
jekyll-gist (1.4.0)
|
78
|
+
octokit (~> 4.2)
|
79
|
+
jekyll-github-metadata (2.2.0)
|
80
|
+
jekyll (~> 3.1)
|
81
|
+
octokit (~> 4.0, != 4.4.0)
|
82
|
+
jekyll-mentions (1.2.0)
|
83
|
+
activesupport (~> 4.0)
|
84
|
+
html-pipeline (~> 2.3)
|
85
|
+
jekyll (~> 3.0)
|
86
|
+
jekyll-paginate (1.1.0)
|
87
|
+
jekyll-redirect-from (0.11.0)
|
88
|
+
jekyll (>= 2.0)
|
89
|
+
jekyll-sass-converter (1.3.0)
|
90
|
+
sass (~> 3.2)
|
91
|
+
jekyll-seo-tag (2.1.0)
|
92
|
+
jekyll (~> 3.3)
|
93
|
+
jekyll-sitemap (0.12.0)
|
94
|
+
jekyll (~> 3.3)
|
95
|
+
jekyll-swiss (0.4.0)
|
96
|
+
jekyll-theme-slate (0.0.4)
|
97
|
+
jekyll (~> 3.3)
|
98
|
+
jekyll-watch (1.5.1)
|
99
|
+
listen (~> 3.0)
|
100
|
+
jemoji (0.7.0)
|
101
|
+
activesupport (~> 4.0)
|
102
|
+
gemoji (~> 2.0)
|
103
|
+
html-pipeline (~> 2.2)
|
104
|
+
jekyll (>= 3.0)
|
105
|
+
json (1.8.6)
|
106
|
+
kramdown (1.11.1)
|
107
|
+
liquid (3.0.6)
|
108
|
+
listen (3.0.6)
|
109
|
+
rb-fsevent (>= 0.9.3)
|
110
|
+
rb-inotify (>= 0.9.7)
|
111
|
+
mercenary (0.3.6)
|
112
|
+
mini_portile2 (2.4.0)
|
113
|
+
minima (2.0.0)
|
114
|
+
minitest (5.11.3)
|
115
|
+
multipart-post (2.1.1)
|
116
|
+
net-dns (0.9.0)
|
117
|
+
nokogiri (1.10.4)
|
118
|
+
mini_portile2 (~> 2.4.0)
|
119
|
+
octokit (4.14.0)
|
120
|
+
sawyer (~> 0.8.0, >= 0.5.3)
|
121
|
+
pathutil (0.16.2)
|
122
|
+
forwardable-extended (~> 2.6)
|
123
|
+
public_suffix (1.5.3)
|
124
|
+
rb-fsevent (0.10.3)
|
125
|
+
rb-inotify (0.10.0)
|
126
|
+
ffi (~> 1.0)
|
127
|
+
rouge (1.11.1)
|
128
|
+
safe_yaml (1.0.5)
|
129
|
+
sass (3.7.4)
|
130
|
+
sass-listen (~> 4.0.0)
|
131
|
+
sass-listen (4.0.0)
|
132
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
133
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
134
|
+
sawyer (0.8.2)
|
135
|
+
addressable (>= 2.3.5)
|
136
|
+
faraday (> 0.8, < 2.0)
|
137
|
+
terminal-table (1.8.0)
|
138
|
+
unicode-display_width (~> 1.1, >= 1.1.1)
|
139
|
+
thread_safe (0.3.6)
|
140
|
+
typhoeus (0.8.0)
|
141
|
+
ethon (>= 0.8.0)
|
142
|
+
tzinfo (1.2.5)
|
143
|
+
thread_safe (~> 0.1)
|
144
|
+
unicode-display_width (1.6.0)
|
145
|
+
|
146
|
+
PLATFORMS
|
147
|
+
ruby
|
148
|
+
|
149
|
+
DEPENDENCIES
|
150
|
+
github-pages
|
151
|
+
jekyll-theme-slate
|
152
|
+
|
153
|
+
BUNDLED WITH
|
154
|
+
2.0.2
|
data/docs/_config.yml
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
---
|
2
|
+
layout: default
|
3
|
+
---
|
4
|
+
|
5
|
+
<link href="{{ site.baseurl }}/assets/style.css" rel="stylesheet" type="text/css">
|
6
|
+
|
7
|
+
<ul class="directory">
|
8
|
+
<li><a href="{{ site.baseurl }}/">Quick Start</a></li>
|
9
|
+
<li><a href="{{ site.baseurl }}/installation">Installation</a></li>
|
10
|
+
<li><a href="{{ site.baseurl }}/usage">Usage</a></li>
|
11
|
+
<li><a href="{{ site.baseurl }}/global_configuration">Global Settings</a></li>
|
12
|
+
<li><a href="{{ site.baseurl }}/presets">Writing Presets</a></li>
|
13
|
+
<li><a href="{{ site.baseurl }}/example_presets">Example Presets</a></li>
|
14
|
+
<li><a href="{{ site.baseurl }}/output">Output Formats</a></li>
|
15
|
+
<li><a href="{{ site.baseurl }}/notes">Notes and FAQ</a></li>
|
16
|
+
<li><a href="{{ site.baseurl }}/contributing">Contributing</a></li>
|
17
|
+
<li><a href="{{ site.baseurl }}/releases">Release History</a></li>
|
18
|
+
</ul>
|
19
|
+
|
20
|
+
<hr />
|
21
|
+
|
22
|
+
{{ content }}
|
23
|
+
|
24
|
+
<script>
|
25
|
+
const navItems = Array.from(document.querySelectorAll('ul.directory li'))
|
26
|
+
const currentPath = window.location.toString()
|
27
|
+
const activeItem = navItems.find(function(item) {
|
28
|
+
return item.firstChild.href == currentPath
|
29
|
+
})
|
30
|
+
|
31
|
+
activeItem.classList.add('active')
|
32
|
+
</script>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
@media (max-width: 600px) {
|
2
|
+
ul.directory {
|
3
|
+
flex-direction: column;
|
4
|
+
align-items: center;
|
5
|
+
}
|
6
|
+
}
|
7
|
+
|
8
|
+
ul.directory {
|
9
|
+
display: flex;
|
10
|
+
flex-wrap: wrap;
|
11
|
+
justify-content: center;
|
12
|
+
list-style: none;
|
13
|
+
padding-left: 0;
|
14
|
+
flex-grow: 0;
|
15
|
+
}
|
16
|
+
|
17
|
+
ul.directory li {
|
18
|
+
margin: .3em;
|
19
|
+
}
|
20
|
+
|
21
|
+
ul.directory a {
|
22
|
+
line-height: 2;
|
23
|
+
padding: 8px 20px;
|
24
|
+
}
|
25
|
+
|
26
|
+
li.active a {
|
27
|
+
border-radius: 3px;
|
28
|
+
background-color: #007edf;
|
29
|
+
color: #fff;
|
30
|
+
box-shadow: 2px 2px 3px #999;
|
31
|
+
}
|
@@ -1,3 +1,5 @@
|
|
1
|
+
---
|
2
|
+
---
|
1
3
|
# Contributing
|
2
4
|
|
3
5
|
Bug reports, feature requests, and feedback are very welcome, either through github issues or via
|
@@ -31,25 +33,31 @@ issues, if possible.
|
|
31
33
|
|
32
34
|
`rake` will run all tests and rubocop.
|
33
35
|
|
36
|
+
## Docs
|
37
|
+
|
38
|
+
The docs are set up for github pages, which is based on jekyll. You can preview them locally as you
|
39
|
+
edit:
|
40
|
+
|
41
|
+
1. `cd docs`
|
42
|
+
2. `bundle install`
|
43
|
+
3. `bundle exec jekyll serve`
|
44
|
+
|
34
45
|
## Guidelines
|
35
46
|
|
36
|
-
* Generally, go for straightforward and readable rather than terse and clever.
|
37
|
-
|
47
|
+
* Generally, go for straightforward and readable rather than terse and clever. I'm not actually a
|
48
|
+
very good programmer; I need simple code that's easy to understand.
|
38
49
|
|
39
50
|
* Internal refactoring is welcome, especially in the name of the previous point.
|
40
51
|
|
41
|
-
* I'm very reluctant to introduce breaking changes to configuration settings.
|
42
|
-
|
52
|
+
* I'm very reluctant to introduce breaking changes to configuration settings. This rule isn't
|
53
|
+
absolute, but I'm not going to do it without a good reason.
|
43
54
|
|
44
|
-
* The addition of new test cases whenever relevant is certainly appreciated.
|
45
|
-
|
46
|
-
|
55
|
+
* The addition of new test cases whenever relevant is certainly appreciated. This project went for
|
56
|
+
awhile without any proper tests, but now that we're at 100% coverage it would be nice to keep it
|
57
|
+
that way.
|
47
58
|
|
48
59
|
* I've been using 80 characters for code and 100 characters for documentation.
|
49
60
|
|
50
|
-
* The code coverage is currently at 100%. I'm not going to make maintaining this a hard and fast
|
51
|
-
rule, but I'd really like to see it stay this way.
|
52
|
-
|
53
61
|
## Hard rules
|
54
62
|
|
55
63
|
* Liquid tag syntax can only be extended; no breaking changes. I'm not willing to force
|
@@ -1,7 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
#
|
4
|
-
|
1
|
+
---
|
2
|
+
---
|
3
|
+
# /_data/picture.yml
|
4
|
+
|
5
|
+
These are example settings- I mostly made them up off the top of my head. You
|
6
|
+
probably don't want to just copy-paste them. The full documentation
|
7
|
+
for these can be found [here]({{ site.baseurl }}/presets).
|
8
|
+
|
9
|
+
```yml
|
5
10
|
|
6
11
|
# Media presets are just named css media queries, used in several places:
|
7
12
|
# - To specify alternate source images (for art direction)
|
@@ -14,44 +19,47 @@ media_presets:
|
|
14
19
|
tablet: 'max-width: 900px'
|
15
20
|
mobile: 'max-width: 600px'
|
16
21
|
|
17
|
-
# Markup presets allow you to group settings together, and select one of them by
|
18
|
-
# tag. All settings are optional.
|
22
|
+
# Markup presets allow you to group settings together, and select one of them by
|
23
|
+
# name in your jekyll tag. All settings are optional.
|
19
24
|
markup_presets:
|
20
|
-
|
21
|
-
# {% picture image.jpg %}), you'll get the 'default' preset:
|
25
|
+
|
22
26
|
default:
|
23
|
-
# What form the output markup should take
|
27
|
+
# What form the output markup should take:
|
24
28
|
markup: auto
|
25
29
|
|
26
30
|
# Must be an array, and order matters. Defaults to just 'original', which
|
27
31
|
# does what you'd expect.
|
28
32
|
formats: [webp, original]
|
29
33
|
|
30
|
-
# Must be an array: which image sizes (width in pixels) to generate (unless
|
31
|
-
# below). If not specified, will use sensible default
|
34
|
+
# Must be an array: which image sizes (width in pixels) to generate (unless
|
35
|
+
# directed otherwise below). If not specified, will use sensible default
|
36
|
+
# values.
|
32
37
|
widths: [200, 400, 800, 1600]
|
33
38
|
|
34
|
-
# Alternate source images (for art direction) are associated with media
|
35
|
-
# can optionally specify a different set of sizes
|
36
|
-
#
|
39
|
+
# Alternate source images (for art direction) are associated with media
|
40
|
+
# query presets. Here, you can optionally specify a different set of sizes
|
41
|
+
# to generate for those alternate source images. This is how you avoid
|
42
|
+
# generating a 1600 pixel wide image that's only shown on narrow screens.
|
37
43
|
# Must be arrays.
|
38
44
|
media_widths:
|
39
45
|
mobile: [200, 400, 600]
|
40
46
|
tablet: [400, 600, 800]
|
41
47
|
|
42
|
-
# For building the 'sizes' attribute on img and source tags. specifies how
|
43
|
-
# be when a given media query is true. Note that every
|
44
|
-
# the same associated sizes
|
48
|
+
# For building the 'sizes' attribute on img and source tags. specifies how
|
49
|
+
# wide the image will be when a given media query is true. Note that every
|
50
|
+
# source in a given <picture> tag will have the same associated sizes
|
51
|
+
# attribute.
|
45
52
|
sizes:
|
46
53
|
mobile: 100vw
|
47
54
|
tablet: 80vw
|
48
55
|
|
49
|
-
# Specifies an optional, unconditional size attribute. Can be given alone,
|
50
|
-
# combination with 'sizes' below, will be given last
|
56
|
+
# Specifies an optional, unconditional size attribute. Can be given alone,
|
57
|
+
# or if specified in combination with 'sizes' below, will be given last
|
58
|
+
# (when no media queries apply).
|
51
59
|
size: 800px
|
52
60
|
|
53
|
-
# Specify the properties of the fallback image. If not specified, will
|
54
|
-
# wide image in the original format.
|
61
|
+
# Specify the properties of the fallback image. If not specified, will
|
62
|
+
# return a 900 pixel wide image in the original format.
|
55
63
|
fallback_width: 800
|
56
64
|
fallback_format: original
|
57
65
|
|
@@ -80,8 +88,8 @@ markup_presets:
|
|
80
88
|
attributes:
|
81
89
|
img: 'class="icon"'
|
82
90
|
|
83
|
-
# Here's an example of how you'd configure jekyll-picture-tag to work with
|
84
|
-
# lazyload:
|
91
|
+
# Here's an example of how you'd configure jekyll-picture-tag to work with
|
92
|
+
# something like lazyload:
|
85
93
|
# https://github.com/verlok/lazyload
|
86
94
|
lazy:
|
87
95
|
# data_auto gives you data-src, data-srcset, and data-sizes instead of src,
|
@@ -93,7 +101,8 @@ markup_presets:
|
|
93
101
|
attributes:
|
94
102
|
img: class="lazy"
|
95
103
|
|
96
|
-
# This is an example of how you'd get generated image and a URL, and nothing
|
104
|
+
# This is an example of how you'd get generated image and a URL, and nothing
|
105
|
+
# else.
|
97
106
|
direct:
|
98
107
|
markup: direct_url
|
99
108
|
fallback_format: webp # Default original
|
@@ -103,3 +112,5 @@ markup_presets:
|
|
103
112
|
srcset:
|
104
113
|
markup: naked_srcset
|
105
114
|
formats: [webp] # must be an array, even if it only has one item
|
115
|
+
|
116
|
+
```
|
@@ -1,3 +1,5 @@
|
|
1
|
+
---
|
2
|
+
---
|
1
3
|
# Global Configuration
|
2
4
|
|
3
5
|
**All configuration is optional**. If you are happy with the defaults, you don't have to touch a
|
@@ -24,8 +26,10 @@ picture:
|
|
24
26
|
To make writing tags easier you can specify a source directory for your assets. Base images in the
|
25
27
|
tag will be relative to the `source` directory, which is relative to the Jekyll site root.
|
26
28
|
|
29
|
+
{% raw %}
|
27
30
|
For example, if `source` is set to `assets/images/_fullsize`, the tag
|
28
31
|
`{% picture enishte/portrait.jpg --alt An unsual picture %}` will look for a file at
|
32
|
+
{% endraw %}
|
29
33
|
`assets/images/_fullsize/enishte/portrait.jpg`.
|
30
34
|
|
31
35
|
* **Destination Image Directory**
|
@@ -112,4 +116,5 @@ picture:
|
|
112
116
|
Whether or not to surround j-p-t's output with a `{::nomarkdown}..{:/nomarkdown}` block when called
|
113
117
|
from within a markdown file.
|
114
118
|
|
115
|
-
This setting is overridden by the same setting in a preset. See [
|
119
|
+
This setting is overridden by the same setting in a preset. See [the notes]({{ site.baseurl
|
120
|
+
}}/notes) for more detailed information.
|
data/docs/index.md
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
---
|
2
|
+
id: quickstart
|
3
|
+
---
|
4
|
+
|
5
|
+
# Quick start / Demo
|
6
|
+
|
7
|
+
**All configuration is optional.** Here's the simplest possible use case:
|
8
|
+
|
9
|
+
1. [Install]({{ site.baseurl }}/installation)
|
10
|
+
|
11
|
+
2. Write this: {% raw %} `{% picture test.jpg %}` {% endraw %}
|
12
|
+
|
13
|
+
3. Get this:
|
14
|
+
|
15
|
+
```html
|
16
|
+
<!-- Formatted for readability -->
|
17
|
+
|
18
|
+
<img src="/generated/test-800-195f7d.jpg"
|
19
|
+
srcset="
|
20
|
+
/generated/test-400-195f7d.jpg 400w,
|
21
|
+
/generated/test-600-195f7d.jpg 600w,
|
22
|
+
/generated/test-800-195f7d.jpg 800w,
|
23
|
+
/generated/test-1000-195f7d.jpg 1000w
|
24
|
+
">
|
25
|
+
```
|
26
|
+
|
27
|
+
(Along with the appropriate images, obviously.)
|
28
|
+
|
29
|
+
### "That's cool, but I just want webp."
|
30
|
+
|
31
|
+
Create `_data/picture.yml`, add the following:
|
32
|
+
|
33
|
+
```yml
|
34
|
+
markup_presets:
|
35
|
+
default:
|
36
|
+
formats: [webp, original]
|
37
|
+
```
|
38
|
+
|
39
|
+
|
40
|
+
### Here's a more complete demonstration:
|
41
|
+
|
42
|
+
[Presets]({{ site.baseurl }}/presets) are named collections of settings that tell JPT what you want it to give you.
|
43
|
+
Media presets are just CSS media queries, and markup presets determine the output text and images.
|
44
|
+
You choose one with the second [tag parameter]({{ site.baseurl }}/usage), or omit for the `default` (as in these
|
45
|
+
examples). They are located in `_data/picture.yml`. Here's an example:
|
46
|
+
|
47
|
+
```yml
|
48
|
+
media_presets:
|
49
|
+
mobile: 'max-width: 600px'
|
50
|
+
|
51
|
+
markup_presets:
|
52
|
+
default:
|
53
|
+
widths: [600, 900, 1200]
|
54
|
+
formats: [webp, original]
|
55
|
+
sizes:
|
56
|
+
mobile: 80vw
|
57
|
+
size: 500px
|
58
|
+
```
|
59
|
+
|
60
|
+
Write this:
|
61
|
+
|
62
|
+
{% raw %}
|
63
|
+
`{% picture test.jpg mobile: test2.jpg --alt Alternate Text %}`
|
64
|
+
{% endraw %}
|
65
|
+
|
66
|
+
Get this:
|
67
|
+
|
68
|
+
```html
|
69
|
+
<!-- Formatted for readability -->
|
70
|
+
|
71
|
+
<picture>
|
72
|
+
<source
|
73
|
+
sizes="(max-width: 600px) 80vw, 600px"
|
74
|
+
media="(max-width: 600px)"
|
75
|
+
srcset="
|
76
|
+
/generated/test2-600-21bb6f.webp 600w,
|
77
|
+
/generated/test2-900-21bb6f.webp 900w,
|
78
|
+
/generated/test2-1200-21bb6f.webp 1200w
|
79
|
+
"
|
80
|
+
type="image/webp">
|
81
|
+
<source
|
82
|
+
sizes="(max-width: 600px) 80vw, 600px"
|
83
|
+
srcset="
|
84
|
+
/generated/test-600-195f7d.webp 600w,
|
85
|
+
/generated/test-900-195f7d.webp 900w,
|
86
|
+
/generated/test-1200-195f7d.webp 1200w
|
87
|
+
"
|
88
|
+
type="image/webp">
|
89
|
+
<source
|
90
|
+
sizes="(max-width: 600px) 80vw, 600px"
|
91
|
+
media="(max-width: 600px)"
|
92
|
+
srcset="
|
93
|
+
/generated/test2-600-21bb6f.jpg 600w,
|
94
|
+
/generated/test2-900-21bb6f.jpg 900w,
|
95
|
+
/generated/test2-1200-21bb6f.jpg 1200w
|
96
|
+
"
|
97
|
+
type="image/jpeg">
|
98
|
+
<source
|
99
|
+
sizes="(max-width: 600px) 80vw, 600px"
|
100
|
+
srcset="
|
101
|
+
/generated/test-600-195f7d.jpg 600w,
|
102
|
+
/generated/test-900-195f7d.jpg 900w,
|
103
|
+
/generated/test-1200-195f7d.jpg 1200w
|
104
|
+
"
|
105
|
+
type="image/jpeg">
|
106
|
+
<img src="/generated/test-800-195f7d.jpg" alt="Alternate Text">
|
107
|
+
</picture>
|
108
|
+
```
|
data/docs/installation.md
CHANGED
@@ -1,30 +1,30 @@
|
|
1
|
+
---
|
2
|
+
---
|
1
3
|
# Installation
|
2
4
|
|
3
|
-
|
5
|
+
* Add `jekyll_picture_tag` to your Gemfile in the `:jekyll_plugins` group:
|
4
6
|
|
5
|
-
```ruby
|
6
|
-
group :jekyll_plugins do
|
7
|
-
|
8
|
-
end
|
9
|
-
```
|
7
|
+
```ruby
|
8
|
+
group :jekyll_plugins do
|
9
|
+
gem 'jekyll_picture_tag'
|
10
|
+
end
|
11
|
+
```
|
10
12
|
|
11
|
-
|
13
|
+
* Run `$ bundle install`
|
12
14
|
|
13
|
-
|
15
|
+
* See if you have ImageMagick with `$ convert --version`. You should see something like this:
|
14
16
|
|
15
|
-
```
|
16
|
-
$ convert --version
|
17
|
-
|
18
|
-
|
17
|
+
```
|
18
|
+
~ $ convert --version
|
19
|
+
Version: ImageMagick 7.0.8-14 Q16 x86_64 2018-10-31 https://imagemagick.org
|
20
|
+
Copyright: © 1999-2018 ImageMagick Studio LLC License: https://imagemagick.org/script/license.php
|
21
|
+
Features: Cipher DPC HDRI OpenMP Delegates (built-in): bzlib fontconfig freetype jng jp2 jpeg lcms
|
22
|
+
lzma pangocairo png tiff webp xml zlib
|
23
|
+
```
|
24
|
+
If you get a 'command not found' error, you'll need to install it. Most package managers know about
|
25
|
+
ImageMagick, otherwise it can be found [here](https://imagemagick.org/script/download.php).
|
19
26
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
License: https://imagemagick.org/script/license.php
|
24
|
-
Features: Cipher DPC HDRI OpenMP
|
25
|
-
Delegates (built-in): bzlib fontconfig freetype jng jp2 jpeg lcms lzma pangocairo png tiff webp xml zlib
|
27
|
+
* **Note webp under delegates.** This is required if you want to generate webp files. Any image format
|
28
|
+
you want to handle will require an appropriate delegate; You may have to install additional packages
|
29
|
+
to accomplish this.
|
26
30
|
|
27
|
-
**Note webp under delegates.** This is required if you want to generate webp files.
|
28
|
-
|
29
|
-
If you get a 'command not found' error, you'll need to install it. Most package managers
|
30
|
-
know about it, otherwise it can be downloaded [here](https://imagemagick.org/script/download.php).
|
data/docs/migration.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
---
|
2
|
+
---
|
1
3
|
# Migrating from versions < 1.0
|
2
4
|
|
3
5
|
This document details the changes from previous versions (Everything before 1.0), and how to migrate
|
@@ -37,7 +39,9 @@ describes how to get your site working with the new version.
|
|
37
39
|
Previous tag syntax has been extended, but backwards compatibility (and behaviour of previous
|
38
40
|
versions) is maintained.
|
39
41
|
|
42
|
+
{% raw %}
|
40
43
|
`{% picture img.jpg (implicit attributes) --(argument) (explicit attributes) %}`
|
44
|
+
{% endraw %}
|
41
45
|
|
42
46
|
Implicit attributes are the old way. They are specified after the last source image, and before any
|
43
47
|
explicit attributes (if they are included). These attributes are applied to the `<img>` tag, as in
|