github gildas-lormeau/single-file-cli v2.16.0

4 hours ago

SingleFile CLI 2.16.0

New features

  • --image-quality sets the quality used to re-encode the JPEG and WebP images resized with --image-reduction-factor, from 0 to 1 (default 0.8). With 1, WebP images are saved without loss. It has no effect on PNG images (SingleFile#2001)

CLI fixes and improvements

  • The Referer sent for a resource now follows the same rules as the browser:
    • The referrerpolicy attribute of an <img>, <link> or <script> is applied to its own request.
    • An image, a font or an @import referenced from an external stylesheet gets a referrer computed from that stylesheet and its Referrer-Policy header, not from the page, when the page cannot fetch it itself (e.g. a file on another site without CORS). When the stylesheet gives no referrer, none is sent in all cases.
    • With --browser-engine firefox, a referrer policy that relaxes the default is ignored for a cross-site request, as Firefox does.
  • --compress-css has no effect anymore. It saved almost nothing and could move background images. The option is still accepted, so existing commands keep working
  • --image-reduction-factor help now says that images whose size is not set by the page (e.g. icons, logos) are displayed smaller
  • single-file-core is updated to 1.6.18, see https://github.com/gildas-lormeau/single-file-core/releases/tag/v1.6.14 to https://github.com/gildas-lormeau/single-file-core/releases/tag/v1.6.18. For the CLI it means the following
  • With --image-reduction-factor, resized WebP images were re-encoded losslessly with Chromium, so the option only saved the pixels it removed. They are now lossy (quality 0.8), like with Firefox. On the page of SingleFile#2001, the archive went from 73.1MB to 9.6MB
  • --image-reduction-factor now also resizes the snapshots of <canvas> elements, and no longer resizes the images of background attributes, which the browser repeats at their natural size
  • A resized SVG <image> without width and height keeps its displayed size
  • A save could wait forever when an image failed to be re-encoded. The original image is kept instead
  • A <link> stylesheet was dropped when its fetch failed, although the page had loaded it. Its rules are now read from the page when the browser allows it, which is the case with --browser-engine firefox
  • Shadow roots keep their delegatesFocus flag and their manual slot assignments
  • The <source> children and the environmentmap attribute of <model> elements are embedded, and model files are saved with their real type
  • A resource fetched with no expected type (e.g. a PDF in an <object>) was requested with the header Accept: undefined. It is now Accept: */*
  • --remove-unused-styles no longer removes:
    • vendor-prefixed values the saving browser does not support, e.g. -moz- values in a save made with Chromium;
    • fallbacks written before a newer value;
    • the declaration a revert-rule rolls back to;
    • rules inside @when/@else;
    • an unmatched selector needed to keep the specificity of a nested rule.
  • The infobar no longer flashes orange when it is expanded right after the saved page is opened

Co-authored by Claude (Claude Code)

Don't miss a new single-file-cli release

NewReleases is sending notifications on new releases.