GuideQuality
Assets and media
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.
| 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 |
Files that break the policy, worst first. Optimize opens the media optimizer; other files link to their record.
What the page shows
Section titled “What the page shows”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.
What counts as a problem
Section titled “What counts as a problem”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.
Set the asset policy
Section titled “Set the asset policy”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.
- 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
- Click Edit on the policy card. The settings sheet opens at
assets.policy. - Pick the scope, then fill the fields below.
- Save. The next assets run, every review and the
assetstopic of the agents’repo_rulestool use the new policy.
| 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.
Optimize an image
Section titled “Optimize an image”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:
- Configure — repository, image path, ref, formats, widths, densities, effort and quality. Click Generate variants. Once generated, the step folds to a summary with Edit.
- 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.
- Markup — ready snippets per framework, such as HTML
<picture>, React, Vue or CSSimage-set(), each with a copy button. - 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.
- 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 and Edit return to earlier steps without losing the chosen variants.
Optimize several files
Section titled “Optimize several files”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.