jekyll_picture_tag 1.7.1 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 62e94c65637b912d5e44da1f3d0a9dac3c2ec8a9f8e538ebac99e2560a348356
4
- data.tar.gz: c845a01518248c1f77fbcdb115546627803e7be27516149e717e09edd07dc75e
3
+ metadata.gz: abfaaaa312c42464c11595294a11c10848f810cb6c1c63ce085b73b557501f8f
4
+ data.tar.gz: 31c075ac80ee1ee500999b4f54c05d1b0b29b4a13230a3f84914dc4b9a035325
5
5
  SHA512:
6
- metadata.gz: f322901c3b54fe9a4564ca480be283bdde4a68e1da505fbe309671546f551686a01f9c03dfa5159a14754f53791e342700f35e33cb7a0b71577ea2e86e282a75
7
- data.tar.gz: 251b9ed64c11dd6e4a460151703234c80d1d0f4bbd6c05f8fda412a7404bf7c8193e65761b5aac6633628e9bec49c587b8fd53dee1961b7a82c0f04d68435fb8
6
+ metadata.gz: 5372b24c10a7049e20f1e2546a2f20cb2c0714cd4f8f8482e7005f503f9b192fe00ad5b4e07599e715cb280dad366a4477d3dd85ad5fc82743ac24309bf1688b
7
+ data.tar.gz: 66640daa48af3f8507a0d0675bd0fc6527a77c02401cdc06bc3ce967d946c61e53233a1a51b0e31812e5dbb462fb2cb37a42681e9b6fa1b00e31a9b7ea8763e0
data/docs/notes.md CHANGED
@@ -12,7 +12,17 @@
12
12
 
13
13
  Jekyll Picture Tag has comprehensive attribute support for all generated HTML. You can add
14
14
  attributes both through the [liquid tag]({{ site.baseurl }}/usage), and the [preset]({{
15
- site.baseurl }}/presets) (scroll down a bi make sure that your hosting
15
+ site.baseurl }}/presets) (scroll down a bit).
16
+
17
+ * ### Input checking
18
+
19
+ Jekyll Picture Tag is very trusting. It doesn't do much checking of your inputs, and it does not
20
+ fail gracefully if you for example pass it a string when it expects an array. It's on the to-do
21
+ list, but for now if you get cryptic errors then double-check your settings and tag arguments.
22
+
23
+ * ### Git LFS
24
+
25
+ I'm Putting this here because it bit me: If you want to use git LFS, make sure that your hosting
16
26
  provider makes those images available during the build process. Netlify, for example, does not.
17
27
  You won't find this out until you have gone through the entire migration process and try to deploy
18
28
  for the first time.
data/docs/output.md CHANGED
@@ -6,7 +6,7 @@
6
6
  This is a listing of the various text arrangements that JPT can give you. Select one by setting
7
7
  `markup:` in the relevant [markup preset]({{ site.baseurl }}/presets).
8
8
 
9
- Example:
9
+ Example:
10
10
 
11
11
  ```yml
12
12
  # /_data/picture.yml
@@ -18,35 +18,46 @@ markup_presets:
18
18
 
19
19
  ## Standard HTML:
20
20
 
21
- * **`picture`:** `<picture>` element surrounding a `<source>` tag for each required srcset, and a
21
+ - **`picture`:** `<picture>` element surrounding a `<source>` tag for each required srcset, and a
22
22
  fallback `<img>`.
23
23
 
24
- * **`img`:** output a single `<img>` tag with a `srcset` entry.
24
+ - **`img`:** output a single `<img>` tag with a `srcset` entry.
25
25
 
26
- * **`auto`:** Supply an img tag when you have only one srcset, otherwise supply a picture tag.
26
+ - **`auto`:** Supply an img tag when you have only one srcset, otherwise supply a picture tag.
27
27
 
28
28
  ## Javascript Friendly:
29
29
 
30
- * **`data_picture`, `data_img`, `data_auto`:** Analogous to their counterparts, but instead of
31
- `src`, `srcset`, and `sizes`, you get `data-src`, `data-srcset`, and `data-sizes`. This allows you
32
- to use javascript for things like [lazy loading](https://github.com/verlok/lazyload). Include a
33
- basic `img` fallback within a `<noscript>` tag by setting `noscript: true` in the preset. This
34
- allows you to keep working images for your non-javascript-enabled users.
30
+ - **`data_picture`, `data_img`, `data_auto`:** Analogous to their counterparts above, but instead of
31
+ `src`, `srcset`, and `sizes`, you get `data-src`, `data-srcset`, and `data-sizes`. This allows you
32
+ to use javascript for things like [lazy loading](https://github.com/verlok/lazyload).
35
33
 
36
- *Example:*
34
+ #### Special Options
37
35
 
38
- ```yml
39
- # /_data/picture.yml
40
- markup_presets:
41
- lazy:
42
- markup: data_auto
43
- noscript: true
44
- ```
36
+ The following preset configuration settings only apply to the `data_` output formats.
37
+
38
+ - **noscript**
39
+
40
+ _Format:_ `noscript: true|false`
41
+
42
+ _Default:_ `false`
43
+
44
+ Include a basic `img` fallback within a `<noscript>` tag, giving your javascript-disabled users
45
+ something to look at.
46
+
47
+ - **data_sizes**
48
+
49
+ _Format:_ `data_sizes: true|false`
50
+
51
+ _Default:_ `true`
52
+
53
+ This option sets whether you would like JPT's auto-generated sizes to be returned as a
54
+ `data-sizes` attribute or a normal `sizes` attribute. (Useful for interfacing nicely with all the
55
+ various JS image libraries out there.)
45
56
 
46
57
  ## Fragments:
47
58
 
48
- * `direct_url`: Generates an image and returns only its url. Uses `fallback_` properties (width
49
- and format).
59
+ - **`direct_url`**: Generates an image and returns only its url. Uses `fallback_` properties (width
60
+ and format).
50
61
 
51
- * `naked_srcset`: Builds a srcset and nothing else (not even the surrounding quotes). Note that the
52
- (image) `format` setting must still be an array, even if you only give it one value.
62
+ - **`naked_srcset`**: Builds a srcset and nothing else (not even the surrounding quotes). Note that the
63
+ (image) `format` setting must still be an array, even if you only give it one value.
data/docs/presets.md CHANGED
@@ -9,6 +9,9 @@ this file, and probably the `_data/` directory as well.
9
9
 
10
10
  Here's an [example data file]({{ site.baseurl }}/example_presets).
11
11
 
12
+ Any settings which are specific to particular output formats are documented on the [output
13
+ formats]({{site.baseurl}}/output) page.
14
+
12
15
  ## Required Knowledge
13
16
 
14
17
  If you don't know the difference between resolution switching and art direction, stop now and read
data/docs/releases.md CHANGED
@@ -2,6 +2,8 @@
2
2
  ---
3
3
  # Release History
4
4
 
5
+ * 1.8.0 Nov 25, 2019
6
+ * Add `data_sizes` setting for the `data_` family of output formats.
5
7
  * 1.7.1 Nov 14, 2019
6
8
  * Fix some HTML attribute related bugs
7
9
  * Add a few items to the FAQ
@@ -6,3 +6,4 @@ fallback_format: original
6
6
  noscript: false
7
7
  link_source: false
8
8
  quality: 75
9
+ data_sizes: true
@@ -18,7 +18,10 @@ module PictureTag
18
18
  end
19
19
 
20
20
  def add_sizes(element, srcset)
21
- element.attributes << { 'data-sizes' => srcset.sizes } if srcset.sizes
21
+ return unless srcset.sizes
22
+
23
+ attribute = PictureTag.preset['data_sizes'] ? 'data-sizes' : 'sizes'
24
+ element.attributes << { attribute => srcset.sizes }
22
25
  end
23
26
 
24
27
  def build_noscript(base_content)
@@ -1,3 +1,3 @@
1
1
  module PictureTag
2
- VERSION = '1.7.1'.freeze
2
+ VERSION = '1.8.0'.freeze
3
3
  end
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: 1.7.1
4
+ version: 1.8.0
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: 2019-11-14 00:00:00.000000000 Z
13
+ date: 2019-11-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler