There's a lot of open issues
A Bridgetown 2.0+ plugin that pre-generates responsive AVIF and WebP image derivatives at multiple widths, exposes a picture_tag helper for <img> elements, a bg_image_block helper that emits CSS image-set() declarations for backgrounds, and an Inspector that retroactively wraps bare <img> tags with responsive <picture> markup.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

>= 2.0, < 3.0
>= 1.16
~> 2.2
 Project Readme

bridgetown-image-pipeline

Gem Version CI License: MIT Downloads

A Bridgetown 2.0+ plugin that pre-generates responsive image derivatives (AVIF, WebP) at multiple widths, plus ERB helpers for <picture> elements and CSS image-set() backgrounds.

Features

  • Build-time derivative generation via libvips. AVIF + WebP at configurable widths (default: 600, 1200, 1600). Source-width-aware (no upscaling).
  • picture_tag helper — emits <picture> with <source> per format and an <img> fallback with srcset + sizes.
  • bg_image_block helper — emits an inline <style> block with background-image: image-set(...) rules for backgrounds. Tailwind-breakpoint aware. Drop-in replacement for bg-[url(...)] utilities.
  • Inspector (optional, off by default) — rewrites bare <img> tags in rendered HTML to wrap them in <picture> with the appropriate sources.
  • Per-derivative cache keyed by source SHA1 + gem version + config fingerprint. Rebuilds skip unchanged sources.

Requirements

  • Ruby >= 3.2
  • Bridgetown >= 2.0, < 3.0
  • libvips with HEIF/AVIF plugin installed

Quick start

# Gemfile
gem "bridgetown-image-pipeline"
# config/initializers.rb
Bridgetown.configure do |config|
  init "bridgetown-image-pipeline"
end
<%= picture_tag "/images/hero.jpg", alt: "...", sizes: "100vw" %>

See docs/INSTALLATION.md for libvips setup, CI configuration, and activation options.

Documentation

License

MIT — see LICENSE.txt.

Status

Maintained by Flagrant. No SLA. Issues and PRs welcome at github.com/beflagrant/bridgetown-image-pipeline.