jekyll-picture-tag-ng 0.2.1 → 0.2.2
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/README.md +2 -0
- data/lib/jekyll-picture-tag-ng/version.rb +1 -1
- data/lib/jekyll-picture-tag-ng.rb +24 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24fa31a62f9db299a6bf311f5e9e6786497bf759e26bc1c29ca1e320331c91cc
|
4
|
+
data.tar.gz: 0472a2f6a44a0a358be737bb2c3bfd42bc5bd266d9c96bedb027a9f889bd0207
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
@@ -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
|