jekyll-imgflow 0.4.1 → 0.4.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 +19 -4
- data/interface.yml +63 -0
- data/lib/jekyll-imgflow/hooks.rb +1 -1
- data/lib/jekyll-imgflow/html_generator.rb +5 -0
- data/lib/jekyll-imgflow/imgflow_tag.rb +2 -1
- data/lib/jekyll-imgflow/interface.rb +36 -0
- data/lib/jekyll-imgflow/parser.rb +2 -0
- data/lib/jekyll-imgflow/version.rb +1 -1
- data/lib/jekyll-imgflow.rb +1 -0
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c30d610c031609c2e1e9040c115d7162013db83ee6149d76bdb87bc97ad7137c
|
|
4
|
+
data.tar.gz: 8c9f212eb074af380df14d2f168f9d9379db196c8ec9b1a4111a850f804015e6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a7f9640c4e7332e769481922c2569114baccc396b6ec4c354f21292421c489ce2d98a3ceaabe50043e10cb351ec497dd88069fb8efe3c3af162774d5148d0adc
|
|
7
|
+
data.tar.gz: a4d19058e5c05578d51a3cb96e6ccf84e84c0516b35cb26ec8c49e7ae18314bdc04725726976d49cdfe9e7e5507be2a18ecc311b66d956e55913ea60eb9f0235
|
data/README.md
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
A [Jekyll](https://jekyllrb.com/) plugin for automatic image optimization with multiple providers and formats.
|
|
6
6
|
|
|
7
|
-
[](https://github.com/gundestrup/jekyll-imgflow/actions/workflows/ci.yml)
|
|
8
|
+
[](https://rubygems.org/gems/jekyll-imgflow)
|
|
9
|
+
[](https://deepwiki.com/gundestrup/jekyll-imgflow)
|
|
8
10
|
[](https://github.com/gundestrup/jekyll-imgflow)
|
|
9
11
|
[](https://semgrep.dev/)
|
|
10
12
|
[](https://www.codefactor.io/repository/github/gundestrup/jekyll-imgflow)
|
|
@@ -35,7 +37,7 @@ imgflow:
|
|
|
35
37
|
> **Configuration:** Only `originals` and `output` are required in `_config.yml`
|
|
36
38
|
> — everything else has sensible defaults. See the
|
|
37
39
|
> [Installation Guide](docs/installation.md#4-add-to-_configyml) for full options.
|
|
38
|
-
|
|
40
|
+
>
|
|
39
41
|
> **Note:** Image references require exact filenames (or paths relative to
|
|
40
42
|
> `originals`). There is no fuzzy matching during the build yet — if you type
|
|
41
43
|
> `photo.jpg` but the file is `photo.jpeg`, the build will fail with an error.
|
|
@@ -55,21 +57,26 @@ imgflow:
|
|
|
55
57
|
## 📚 Documentation
|
|
56
58
|
|
|
57
59
|
### Getting Started
|
|
60
|
+
|
|
58
61
|
- **[Installation Guide](docs/installation.md)** - Detailed setup instructions
|
|
59
62
|
- **[Basic Usage](docs/usage/)** - Core functionality and examples
|
|
63
|
+
- **[Tag Options](docs/usage/tag-options.md)** - Every `{% imgflow %}` parameter
|
|
60
64
|
- **[Picture Tag Migration](docs/picture_tag_migration.md)** - Migrate from Picture Tag
|
|
61
65
|
|
|
62
66
|
### Configuration
|
|
67
|
+
|
|
63
68
|
- **[Provider Setup](docs/providers.md)** - Configure image providers
|
|
64
69
|
- **[Docker Services](docs/docker.md)** - Using Docker containers
|
|
65
70
|
- **[Presets System](docs/usage/presets.md)** - Predefined configurations
|
|
66
71
|
|
|
67
72
|
### Development
|
|
73
|
+
|
|
68
74
|
- **[Development Guide](docs/development.md)** - Contributing and setup
|
|
69
75
|
- **[Testing Guide](docs/testing.md)** - Running and writing tests
|
|
70
76
|
- **[Scripts Reference](docs/scripts.md)** - Development utilities
|
|
71
77
|
|
|
72
78
|
### Performance
|
|
79
|
+
|
|
73
80
|
- **[Provider Comparison](docs/providers.md)** - Performance benchmarks
|
|
74
81
|
- **[Parallel Testing](docs/parallel_testing.md)** - Fast test execution
|
|
75
82
|
|
|
@@ -80,6 +87,7 @@ ImgFlow has two processing flows: **Build-Time** (pre-generation) and **Runtime*
|
|
|
80
87
|
**See:** [ARCHITECTURE.md](docs/ARCHITECTURE.md) for detailed component architecture and data flow
|
|
81
88
|
|
|
82
89
|
### Quick Overview
|
|
90
|
+
|
|
83
91
|
- **Build-Time Flow** - Pre-generate images during Jekyll build
|
|
84
92
|
- **Runtime Flow** - Process images on-demand during template rendering
|
|
85
93
|
- **Providers** - Image processing backends (CLI tools, HTTP APIs)
|
|
@@ -88,11 +96,13 @@ ImgFlow has two processing flows: **Build-Time** (pre-generation) and **Runtime*
|
|
|
88
96
|
## 🎯 Provider Support
|
|
89
97
|
|
|
90
98
|
### HTTP API Services (Recommended)
|
|
99
|
+
|
|
91
100
|
- **[Imgproxy](https://github.com/imgproxy/imgproxy)** - Fast, reliable (Port 4022)
|
|
92
101
|
- **[Weserv](https://github.com/weserv/images)** - Battle-tested (Port 4026)
|
|
93
102
|
- **[Flyimg](https://github.com/flyimg/flyimg)** - On-the-fly processing (Port 4030)
|
|
94
103
|
|
|
95
104
|
### CLI Tools (Local)
|
|
105
|
+
|
|
96
106
|
- **[Sharp](https://github.com/lovell/sharp)** - Node.js/libvips processing
|
|
97
107
|
- **[ImageMagick](https://github.com/ImageMagick/ImageMagick)** - Feature-rich
|
|
98
108
|
- **[LibVips](https://github.com/libvips/libvips)** - Memory efficient
|
|
@@ -143,6 +153,7 @@ rake check_services # Verify services
|
|
|
143
153
|
## 📦 Installation
|
|
144
154
|
|
|
145
155
|
### Quick Setup
|
|
156
|
+
|
|
146
157
|
```bash
|
|
147
158
|
# Add to Gemfile
|
|
148
159
|
gem 'jekyll-imgflow'
|
|
@@ -167,6 +178,8 @@ imgflow:
|
|
|
167
178
|
|
|
168
179
|
**See:** [installation.md](docs/installation.md) for detailed installation and
|
|
169
180
|
[all configuration options](docs/installation.md#4-add-to-_configyml),
|
|
181
|
+
[tag-options.md](docs/usage/tag-options.md) for every `{% imgflow %}` option
|
|
182
|
+
(operations, HTML attributes, `markup:` output formats),
|
|
170
183
|
[presets.md](docs/usage/presets.md) for the preset system
|
|
171
184
|
|
|
172
185
|
## 🐳 Docker Setup (Recommended)
|
|
@@ -206,7 +219,7 @@ bin/imgflow_migrate_presets
|
|
|
206
219
|
Latest benchmarks show **Sharp** as the fastest provider:
|
|
207
220
|
|
|
208
221
|
| Provider | Time (s) | Speed |
|
|
209
|
-
|
|
222
|
+
| ---------- | ---------- | ------- |
|
|
210
223
|
| [Sharp](https://github.com/lovell/sharp) | 13.97 | 🏆 Fastest |
|
|
211
224
|
| [LibVips](https://github.com/libvips/libvips) | 21.89 | Very Fast |
|
|
212
225
|
| [Weserv](https://github.com/weserv/images) | 30.19 | Fast |
|
|
@@ -218,6 +231,7 @@ Latest benchmarks show **Sharp** as the fastest provider:
|
|
|
218
231
|
## 🛠️ Development
|
|
219
232
|
|
|
220
233
|
### Quick Setup
|
|
234
|
+
|
|
221
235
|
```bash
|
|
222
236
|
# Clone and setup
|
|
223
237
|
git clone <repository>
|
|
@@ -231,7 +245,7 @@ rake download_test_images
|
|
|
231
245
|
rake ci
|
|
232
246
|
|
|
233
247
|
# Run the local Semgrep Pro rules directly
|
|
234
|
-
semgrep scan --pro --config .semgrep.yml --error
|
|
248
|
+
semgrep scan --pro --config .semgrep.yml --error .
|
|
235
249
|
|
|
236
250
|
# Sync the repository scan and findings with the Semgrep dashboard
|
|
237
251
|
# (requires semgrep login or SEMGREP_APP_TOKEN)
|
|
@@ -239,6 +253,7 @@ semgrep ci
|
|
|
239
253
|
```
|
|
240
254
|
|
|
241
255
|
### Key Files
|
|
256
|
+
|
|
242
257
|
- **`lib/jekyll-imgflow.rb`** - Main module
|
|
243
258
|
- **`lib/jekyll-imgflow/imgflow_tag.rb`** - Main tag implementation
|
|
244
259
|
- **`lib/jekyll-imgflow/html_generator.rb`** - HTML generation
|
data/interface.yml
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Generated by `rake interface` — do not edit.
|
|
2
|
+
# Public tag/config surface for tooling (editor extensions, doc linters).
|
|
3
|
+
---
|
|
4
|
+
gem: jekyll-imgflow
|
|
5
|
+
version: 0.4.2
|
|
6
|
+
tags:
|
|
7
|
+
imgflow:
|
|
8
|
+
params:
|
|
9
|
+
- alt
|
|
10
|
+
- aspect_ratio
|
|
11
|
+
- class
|
|
12
|
+
- format
|
|
13
|
+
- formats
|
|
14
|
+
- height
|
|
15
|
+
- keep
|
|
16
|
+
- level
|
|
17
|
+
- link
|
|
18
|
+
- loading
|
|
19
|
+
- markup
|
|
20
|
+
- modal
|
|
21
|
+
- opacity
|
|
22
|
+
- optimize
|
|
23
|
+
- position
|
|
24
|
+
- preset
|
|
25
|
+
- quality
|
|
26
|
+
- ratio
|
|
27
|
+
- title
|
|
28
|
+
- watermark
|
|
29
|
+
- width
|
|
30
|
+
filters: []
|
|
31
|
+
config:
|
|
32
|
+
imgflow:
|
|
33
|
+
- backend_priority
|
|
34
|
+
- cache_dir
|
|
35
|
+
- fallback_format
|
|
36
|
+
- flyimg_url
|
|
37
|
+
- formats
|
|
38
|
+
- image_modal
|
|
39
|
+
- imgproxy_url
|
|
40
|
+
- input_formats
|
|
41
|
+
- optimize_qualities
|
|
42
|
+
- originals
|
|
43
|
+
- output
|
|
44
|
+
- quality
|
|
45
|
+
- sharp_url
|
|
46
|
+
- sizes
|
|
47
|
+
- weserv_url
|
|
48
|
+
enums:
|
|
49
|
+
markup:
|
|
50
|
+
- auto
|
|
51
|
+
- data_auto
|
|
52
|
+
- data_img
|
|
53
|
+
- data_picture
|
|
54
|
+
- direct_url
|
|
55
|
+
- img
|
|
56
|
+
- naked_srcset
|
|
57
|
+
- picture
|
|
58
|
+
level:
|
|
59
|
+
- default
|
|
60
|
+
- high
|
|
61
|
+
- low
|
|
62
|
+
- maximum
|
|
63
|
+
- medium
|
data/lib/jekyll-imgflow/hooks.rb
CHANGED
|
@@ -33,7 +33,7 @@ module JekyllImgFlow
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
# Save final manifest after template rendering (single writer)
|
|
36
|
-
Jekyll::Hooks.register :site, :post_write do |site|
|
|
36
|
+
Jekyll::Hooks.register :site, :post_write, priority: :normal do |site|
|
|
37
37
|
Jekyll.logger.info "🔌 ImgFlow post_write hook - saving final manifest with page usage"
|
|
38
38
|
|
|
39
39
|
if site.imgflow_components && site.imgflow_components[:manifest]
|
|
@@ -6,6 +6,11 @@ module JekyllImgFlow
|
|
|
6
6
|
class HtmlGenerator
|
|
7
7
|
include ModalWrapper
|
|
8
8
|
|
|
9
|
+
# Markup formats accepted via `markup:` (see docs/usage/tag-options.md).
|
|
10
|
+
# Unknown values fall back to `img`.
|
|
11
|
+
MARKUP_FORMATS = %w[img picture auto data_img data_picture data_auto
|
|
12
|
+
direct_url naked_srcset].freeze
|
|
13
|
+
|
|
9
14
|
# Generate HTML based on markup format and attributes
|
|
10
15
|
# @param results [Array<String>] Processed image paths
|
|
11
16
|
# @param attributes [Hash] HTML attributes by element
|
|
@@ -113,7 +113,8 @@ module Jekyll
|
|
|
113
113
|
relative_modal_results = modal_results.uniq.map do |result|
|
|
114
114
|
relative_result_path(result, site)
|
|
115
115
|
end
|
|
116
|
-
|
|
116
|
+
auto_markup = [nil, "auto"].include?(parsed[:markup_format])
|
|
117
|
+
parsed = parsed.merge(markup_format: "picture") if relative_results.length > 1 && auto_markup
|
|
117
118
|
generate_html(relative_results, parsed.merge(modal_results: relative_modal_results), context)
|
|
118
119
|
end
|
|
119
120
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module JekyllImgFlow
|
|
4
|
+
# Machine-readable description of the plugin's public interface:
|
|
5
|
+
# Liquid tags + their params, config keys, and enum values.
|
|
6
|
+
# `rake interface` writes this as interface.yml (shipped in the gem) so
|
|
7
|
+
# tooling like editor extensions can consume it without parsing Ruby.
|
|
8
|
+
module Interface
|
|
9
|
+
TAGS = {
|
|
10
|
+
"imgflow" => (Parser::OPERATION_PARAMS + Parser::HTML_ATTRIBUTES + %i[markup])
|
|
11
|
+
.map(&:to_s).sort.freeze
|
|
12
|
+
}.freeze
|
|
13
|
+
|
|
14
|
+
# Config keys read outside CORE_CONFIG_DEFAULTS in config.rb
|
|
15
|
+
EXTRA_CONFIG_KEYS = %w[
|
|
16
|
+
cache_dir image_modal imgproxy_url weserv_url flyimg_url sharp_url
|
|
17
|
+
optimize_qualities
|
|
18
|
+
].freeze
|
|
19
|
+
|
|
20
|
+
def self.to_h
|
|
21
|
+
{
|
|
22
|
+
"gem" => "jekyll-imgflow",
|
|
23
|
+
"version" => VERSION,
|
|
24
|
+
"tags" => TAGS.transform_values { |params| { "params" => params } },
|
|
25
|
+
"filters" => [],
|
|
26
|
+
"config" => {
|
|
27
|
+
"imgflow" => (Config::CORE_CONFIG_DEFAULTS.keys + EXTRA_CONFIG_KEYS).sort
|
|
28
|
+
},
|
|
29
|
+
"enums" => {
|
|
30
|
+
"markup" => HtmlGenerator::MARKUP_FORMATS.sort,
|
|
31
|
+
"level" => %w[default high low maximum medium]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -185,6 +185,7 @@ module JekyllImgFlow
|
|
|
185
185
|
operations: [],
|
|
186
186
|
html_attributes: {},
|
|
187
187
|
raw_options: raw_options,
|
|
188
|
+
markup_format: nil,
|
|
188
189
|
preset: nil,
|
|
189
190
|
error: error_message
|
|
190
191
|
}
|
|
@@ -196,6 +197,7 @@ module JekyllImgFlow
|
|
|
196
197
|
operations: operations,
|
|
197
198
|
html_attributes: html_attributes,
|
|
198
199
|
raw_options: raw_options,
|
|
200
|
+
markup_format: raw_options[:markup] || raw_options[:markup_format],
|
|
199
201
|
preset: raw_options[:preset]
|
|
200
202
|
}
|
|
201
203
|
end
|
data/lib/jekyll-imgflow.rb
CHANGED
|
@@ -29,6 +29,7 @@ require_relative "jekyll-imgflow/imgflow_tag"
|
|
|
29
29
|
require_relative "jekyll-imgflow/picture_tag_adaptor"
|
|
30
30
|
require_relative "jekyll-imgflow/picture_tag_preset_migrator"
|
|
31
31
|
require_relative "jekyll-imgflow/hooks"
|
|
32
|
+
require_relative "jekyll-imgflow/interface"
|
|
32
33
|
|
|
33
34
|
module JekyllImgFlow
|
|
34
35
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jekyll-imgflow
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Svend Gundestrup
|
|
@@ -62,6 +62,7 @@ extra_rdoc_files: []
|
|
|
62
62
|
files:
|
|
63
63
|
- LICENSE
|
|
64
64
|
- README.md
|
|
65
|
+
- interface.yml
|
|
65
66
|
- lib/jekyll-imgflow.rb
|
|
66
67
|
- lib/jekyll-imgflow/animated_gif_detector.rb
|
|
67
68
|
- lib/jekyll-imgflow/batch_manager.rb
|
|
@@ -73,6 +74,7 @@ files:
|
|
|
73
74
|
- lib/jekyll-imgflow/hooks.rb
|
|
74
75
|
- lib/jekyll-imgflow/html_generator.rb
|
|
75
76
|
- lib/jekyll-imgflow/imgflow_tag.rb
|
|
77
|
+
- lib/jekyll-imgflow/interface.rb
|
|
76
78
|
- lib/jekyll-imgflow/manifest_manager.rb
|
|
77
79
|
- lib/jekyll-imgflow/modal_assets.rb
|
|
78
80
|
- lib/jekyll-imgflow/operation_processor.rb
|