Skip to content
GitHub

GuideQuality

Assets and media

In the panel: Quality › Assets/quality/assetsNeeds analyses:read

Find images, fonts, audio and video that break your asset policy or could be smaller, set the policy per team, and turn heavy images into optimized variants with a merge request.

In the panel · Quality › Assets
AssetsBreaks the policyAny savingEverythingKind: allFormat: allSort: severityConfigureOptimize an image
184 MB asset weight · 23 repositories41 MB potential saving · 22%9,412 files checked18 errors126 warnings3.2 MB duplicates2 budgets exceeded+4.6 MB since previous records
File Repository Format Size Problems Saving
public/images/hero-banner.png acme/checkout-web PNG 1.8 MB Over 1 MB No WebP −1.5 MB · WebP Optimize
src/assets/fonts/Display-Bold.ttf acme/admin-ui TTF 412 kB Format not allowed −239 kB · WOFF2 Details
static/video/intro.mp4 acme/landing MP4 640 kB Over 500 kB — Details
public/icons/logo.svg acme/widget-kit SVG 38 kB Saving −15.6 kB · svgo Optimize
Load more files

Files that break the policy, worst first. Optimize opens the media optimizer; other files link to their record.

The strip sums the newest assets record of every repository in scope: total asset weight, the potential saving and its share, files checked, policy errors and warnings, bytes in duplicate copies, exceeded budgets and the weight change against the previous records. These figures follow the scope, not the status, kind and format filters. Under the strip, By kind shows a bar of bytes per kind (images, fonts, audio, video, atlases, models, data) and the repositories over a budget.

The table lists one row per file:

Column Meaning
File The path in the repository.
Repository Opens the repository hub at Quality › Assets.
Format The file format.
Size Bytes on disk.
Problems The first two problems as tags, with their messages.
Saving The potential saving with a bar and the best conversion, such as PNG to WebP or TTF to WOFF2.
Action Optimize for images the optimizer can work on, otherwise Details, which opens the analysis record.

The toolbar’s status switch picks Breaks the policy (the default), Any saving or Everything. Kind and Format narrow to one choice each, and the sort orders by severity, saving or size. The search in the header matches every word against repository, path and format, but only among the rows already loaded: Load more files fetches the next page. Filters other than the search live in the URL.

Each file is checked against the asset policy that covers its repository:

Problem Severity When
Format error The extension is not in the allowed formats.
Size warning or error The file is over the warning or error limit for its kind.
Dimensions warning A raster image or video is wider or taller than the limit. SVGs are not checked.
Modern format warning A PNG, JPEG or GIF from 8 kB ships without the required WebP or AVIF next to it.
Budget error The repository’s total, or one kind’s total, is over its budget.
Duplicate info The same bytes exist at another path.
Saving info No rule is broken, but a conversion would save enough to be worth it.

Files are scanned in public/, assets/, static/, src/**/assets/ and res/ by default. The analyzer runs when the default branch changes, at most once a day; ⋯ on the page runs it at once.

The policy says which formats, sizes and dimensions are acceptable. It is a setting, assets.policy, scoped like every setting: an entry for every repository, overridden by team, path pattern or repository entries, the most specific entry winning as a whole.

The Asset policy card under the table shows the fleet’s policy and how many team, path or repository entries override it. Narrowed to one repository, it shows that repository’s effective policy and where it comes from.

In the panel · Quality › Assets › Asset policy
Asset policyAll repositories · 3 overridesEdit
Raster images
PNG, JPEG and GIF from 8 kB need WebP next to them
SVG
Optimize with svgo
Max file size
warn at 500 kB, error at 1 MB
Max dimension
2560 px
Smallest saving
5% and 1 kB
Ignored
vendor/**, **/*.min.*, fixtures/**
Mode
Comment
  1. Click Edit on the policy card. The settings sheet opens at assets.policy.
  2. Pick the scope, then fill the fields below.
  3. Save. The next assets run, every review and the assets topic of the agents’ repo_rules tool use the new policy.
In the panel · Settings › assets.policy
ScopeTeam · Widgets
Raster formatavif+webpwebp, avif, avif+webp or keep
SVGoptimizeoptimize or keep
Allowed formatspng, jpg, webp, avif, svg, woff2
Max bytes · warn300000
Max bytes · error800000
Max dimension2560
Modesuggest-mrcomment or suggest-mr
Budgetstotal 20 MB · image 15 MB
Ignorevendor/**, **/*.min.*, fixtures/**
Field Default Meaning
Raster format webp Modern format every PNG, JPEG and GIF from 8 kB needs next to it: webp, avif, avif+webp or keep.
SVG optimize optimize suggests svgo rewrites; keep leaves SVGs alone.
Allowed formats any Extensions allowed at all; files of other formats are errors.
Max bytes warn 500 kB, error 1 MB Per file, optionally per kind.
Max dimension 2560 Largest width or height of raster images and videos.
Smallest saving 5% and 1 kB Conversions saving less than both are not suggested.
Ignore vendor/**, **/*.min.*, fixtures/** Globs left out of everything.
Budgets none Total bytes of every asset, and bytes per kind.
Mode comment With suggest-mr, reviews also offer a merge request with the variants from the panel.

Configure on the page edits the analyzer’s own options (analyzers.assets): which folders to scan, a build output folder to scan as well, how many of the largest images to optimize and the svgo preset.

The media optimizer turns one heavy image into WebP, AVIF and resized variants, writes the markup that uses them and delivers the files as a merge request or a ZIP. It opens from Optimize on a row, from Optimize an image in the header (on a blank file, with a repository picker), or from a link in a review comment about an image.

It works in four steps:

  1. Configure — repository, image path, ref, formats, widths, densities, effort and quality. Click Generate variants. Once generated, the step folds to a summary with Edit.
  2. Choose variants — the original size, the best saving and a table of offered variants with a thumbnail, size, saving and the path each will be written to. Variants whose path already exists at the ref start unchosen; choosing one anyway is a conflict until you change its path. An optimized SVG, or a variant at the original’s own path, replaces the original.
  3. Markup — ready snippets per framework, such as HTML <picture>, React, Vue or CSS image-set(), each with a copy button.
  4. Deliver — an optional merge request title, then Open merge request or Download ZIP. The result shows the merge request link and any files the forge refused to write.
In the panel · Quality › Assets › Optimize
public/images/hero-banner.pngacme/checkout-web1 of 16
ConfigureChoose variantsMarkupDeliver
Original
PNG · 2400 × 1200 · 1.8 MB
Best saving
−1.5 MB (86%) · WebP 1920w
Chosen
6 variants · 412 kB in all
Variant Size Saving Path
☑ WebP · 640w 38 kB −98% public/images/hero-banner-640w.webp
☑ WebP · 1280w 104 kB −94% public/images/hero-banner-1280w.webp
☑ AVIF · 1280w 71 kB −96% public/images/hero-banner-1280w.avif
☐ PNG · 2400w 1.4 MB −22% public/images/hero-banner.png
Back Next

Back and Edit return to earlier steps without losing the chosen variants.

Tick the rows you want and click Optimize N selected, or click Optimize to queue every optimizable row shown. Step through the queue with J / K; the sheet shows your place, such as “3 of 16”, and each file starts fresh.