35 lines
1.7 KiB
Markdown
35 lines
1.7 KiB
Markdown
# Optimization
|
|
|
|
SVG Tools ships SVGO 4.0.2 (`gitHead`
|
|
`b2309cf541aee11634eb653157b0ff86ab326e98`) inside a module worker. The exact
|
|
version and active plugin list are displayed with every result.
|
|
|
|
## Profiles
|
|
|
|
- **Conservative:** cleanup and safe numeric/style normalization while retaining
|
|
IDs, metadata, viewBox, dimensions and accessibility content.
|
|
- **Balanced:** additional structural cleanup with protected identifiers and
|
|
accessibility-sensitive content.
|
|
- **Aggressive:** explicitly lossy/structural choices for users who accept the
|
|
disclosed risk.
|
|
|
|
Optional plugins are selected explicitly in the dialog; plugin names are mapped
|
|
to an application allowlist rather than passed through from imported data. See
|
|
`src/optimization/profiles.ts` for the authoritative ordered lists.
|
|
|
|
The worker returns source, exact before/after UTF-8 byte counts, version and
|
|
plugins. The main thread rejects stale job IDs. Closing/canceling, a superseding
|
|
request or AbortSignal immediately rejects the old promise, removes listeners,
|
|
clears its timer and terminates its worker. A 30-second safety timeout is the
|
|
final boundary.
|
|
|
|
Optimization never mutates source automatically. A result remains a candidate
|
|
with size summary, source diff and side-by-side isolated visual comparison until
|
|
Apply. Applying checks the source revision and produces one undoable transaction.
|
|
|
|
Even conservative SVGO passes can change insignificant lexical form and browser
|
|
edge behavior. Aggressive plugins can change IDs, metadata, editorability or
|
|
rendering. Visual comparison cannot prove semantic equivalence, especially for
|
|
fonts, filters, animation and external consumer behavior. Keep original source
|
|
and use project/domain fixtures for important artwork.
|