Repository navigation
feat(book): image-quality and offline-images for light illustrated books - #18
Merged
Merged
Conversation
offline-images: false keeps img/ out of the service worker's precache, marks every image loading=lazy and caches each image when it is first fetched. The counting strip moves far off screen, because Chrome fetched the first lazy image of every chapter at -200vw on a phone. image-quality sets the WebP quality; the default keeps the old image names, so existing books keep their edition. Closes #17 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #17.
image-quality(html output, default 80) sets the WebP quality. At the default the image names stay as they were, so existing books do not change edition.offline-images(default true, today's behaviour). Withfalse:img/leaves the precache list, each image getsloading="lazy" decoding="async", and the worker caches an image the first time it is fetched.#measuremoves totranslate(-100000px, -100000px). Chrome fetches lazy images within about a screen of the viewport even undervisibility:hidden. At-200vwa phone fetched the first image of every chapter while counting pages.Measured on a 23-chapter book with 245 illustrations (720 px, quality 60,
offline-images: false): the first visit downloads about 1 MB, with one image (the cover). Opening a chapter and turning three pages fetches 4 more. Before, the whole 46 MB came down on install.Tests: unit tests for quality and lazy tags, the precache list without
img/, and a browser test that counting pages fetches no image of an unopened chapter. That test fails on phone with the old-200vwoffset.uv run pytest: 349 passed.-m browser: 20 passed.🤖 Generated with Claude Code