jekyll-picture-tag-ng 0.2.1 → 0.2.2

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: 991b7c6d81da1fa46e2193cccef939dc7fffeaa396efe3d29f247215a8ad6a61
4
- data.tar.gz: 4b12be741cd2d3ee29c3fb36db63469a271482950ff120a855bc22b52e3693c7
3
+ metadata.gz: 24fa31a62f9db299a6bf311f5e9e6786497bf759e26bc1c29ca1e320331c91cc
4
+ data.tar.gz: 0472a2f6a44a0a358be737bb2c3bfd42bc5bd266d9c96bedb027a9f889bd0207
5
5
  SHA512:
6
- metadata.gz: 877a32abd05c5038f6699fef5f62fbb7ef66c31371d9e5f2888b4fd846334e439b143abd88b7e6c08f182ff19e62dc9517dc5a6aecacf4ef93a2ff90ee3fdc5a
7
- data.tar.gz: 1fab3140ccc61b490bf3eee1af1385b15472ed3bac22c02a5228d53fa3898d876c4afaf5ea9886b65567a57ca7ee4d30d335a1cd50ac826624b19b41b392c033
6
+ metadata.gz: a9d425639ebb2ac9db33b231b19acd323eaa0efa7d3df9cb4aa8233df1c4395f1e1c6d561701d8e6c6389633d6c535e63969663df2b8fa485d873456915cd7de
7
+ data.tar.gz: be4985d422441d0ad62dea7f401982d4edb30ce05e01d1819a22eaefe3efef88c7099e1cf702fd79295546ab46d59f3347edbb2bebad180147c191628b72c294
data/README.md CHANGED
@@ -61,6 +61,7 @@ Configuration is done in the `_config.yml` of your website, under the `picture_t
61
61
 
62
62
  ```yaml
63
63
  picture_tag_ng:
64
+ parallel: false
64
65
  background_color: FFFFFF
65
66
  picture_versions:
66
67
  m: 700
@@ -71,6 +72,7 @@ The example above is equivalent to the defaults.
71
72
 
72
73
  - `background_color` is the color used to replace transparency when converting from `webp` to `jpeg`
73
74
  - `picture_versions` maps version names to target widths in pixels. The default configuration above produces output files 700px wide in `img/m/` and 400px wide in `img/s/`.
75
+ - `parallel` is a boolean indicating if you want to generate the output files in parallel threads. With a website that has a lot of large pictures, I get ~30% speed improvements when generating the site locally. However, this seems to make building the site with the recommended Github workflow fail.
74
76
 
75
77
  ## Development
76
78
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module PictureTag
5
- VERSION = "0.2.1"
5
+ VERSION = "0.2.2"
6
6
  end
7
7
  end
@@ -96,6 +96,30 @@ Jekyll::Hooks.register :site, :after_init do |site|
96
96
  Kramdown::Converter::JEKYLL_SITE = site
97
97
  end
98
98
 
99
+ module Jekyll
100
+ # Override the write methid to paralellize it
101
+ class Site
102
+ alias_method "old_write", "write"
103
+
104
+ def write
105
+ if config["picture_tag_ng"]["parallel"]
106
+ Jekyll.logger.info "Writing files in parallel (should not work on GH Pages)"
107
+ Jekyll::Commands::Doctor.conflicting_urls(self)
108
+ threads = []
109
+ each_site_file do |item|
110
+ threads << Thread.new { item.write(dest) } if regenerator.regenerate?(item)
111
+ end
112
+ threads.each(&:join)
113
+ regenerator.write_metadata
114
+ Jekyll::Hooks.trigger :site, :post_write, self
115
+ nil
116
+ else
117
+ old_write
118
+ end
119
+ end
120
+ end
121
+ end
122
+
99
123
  module Kramdown
100
124
  module Parser
101
125
  # Override Kramdown parser
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-picture-tag-ng
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - pcouy