CLI

tenon media

Render image variants again.

Tenon stores resized copies of each image, called variants, next to the original. When you change how images are resized, the stored variants no longer match. tenon media regenerate brings them in line with your config.

tenon media regenerate

npx tenon media regenerate

Run it after you change media.images, for example the sizes, the presets, the format or the image provider. It does two things:

  • It deletes stored variants that your options no longer produce.
  • With prerender, it renders the variants that are missing.

It prints how many variants it rendered and removed.

Renders every variant again, also the ones that exist. Use it after an upgrade of sharp, or when the output of your provider changed.Loads another config file than tenon.config.ts.

Where it runs

tenon media regenerate works on the local project only. It renders with your image provider and writes to your media storage, so run it where tenon.config.ts reaches both.

  • --url and TENON_URL are refused.
  • With media: false, it stops: there is no media library.
  • A config for Cloudflare runs only there. Call cms.media.regenerate() from code on Cloudflare instead.

Without an image provider

Without a provider, Tenon renders nothing on the server. The admin makes its own small previews in the browser instead. The command then says how many images have no preview yet. To create them, open Media in the admin and choose Create missing previews.