Skip to content

Commit

Permalink
Update docs. (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkenny54 authored Nov 2, 2024
1 parent 7784abd commit 6064aef
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 1 deletion.
16 changes: 16 additions & 0 deletions docs/plugins/cleanupTextElements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# cleanupTextElements

Simplifies and merges `<text>` and `<tspan>` elements.

## Details

The plugin has no effect if:

- The document has scripts.
- The document has `<style>` elements.

This plugin makes the following transformations:

- Removes `xml:space="preserve"` if the element does not contain significant whitespace.
- Removes unused `x` and `y` attributes from `<text>` elements.
- Merges `<text>` and `<tspan>` elements where possible.
16 changes: 16 additions & 0 deletions docs/plugins/minifyGradients.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# minifyGradients

Simplifies and merges gradients.

## Details

The plugin has no effect if:

- The document has scripts.
- The document has `<style>` elements with CSS which **svgo-ll** is not able to process.

This plugin makes the following transformations:

- `stop` attributes are written in the shortest format (for example, `"90%"` becomes `".9"`).
- If a gradient consists of a single solid color, any references to the gradient are changed to use the color itself.
- If a gradient is used as a [template](https://svgwg.org/svg2-draft/pservers.html#PaintServerTemplates) and is only referenced once, the template is merged with the referencing gradient.
7 changes: 6 additions & 1 deletion docs/plugins/round.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Rounds numbers to a shorter form.

- `coordDigits`: **number** - the number of digits after the decimal place to round x/y coordinates and width/height values (default: **4**)
- `opacityDigits`: **number** - the number of digits after the decimal place to round opacity values (default: **3**)
- `stopOffsetDigits`: **number** - the number of digits after the decimal place to round stop offset values (default: **3**)

## Details

Expand All @@ -30,8 +31,12 @@ If the dimension of the element or its ancestors cannot be determined, or if the

### Opacities

`opacity` and `fill-opacity` values are rounded to the number of digits specified by the `opacityDigits` parameter.
`opacity`, `fill-opacity`, and `stop-opacity` values are rounded to the number of digits specified by the `opacityDigits` parameter.

### Colors

Any colors specified using RGB percentages are converted to integer RGB values, and minified as they are in the [minifyColors](./minifyColors.md) plugin.

### Stop Offsets

The `offset` attribute of `<stop>` elements is rounded to the number of digits specified by the `stopOffsetDigits` parameter.
2 changes: 2 additions & 0 deletions docs/preset-default.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The following plugins are included in `preset-default`, in the order that they a
- minifyStyles
- [cleanupIds](./plugins/cleanupIds.md)
- [minifyColors](./plugins/minifyColors.md)
- [minifyGradients](./plugins/minifyGradients.md)
- [removeUnknownsAndDefaults](./plugins/removeUnknownsAndDefaults.md)
- removeNonInheritableGroupAttrs
- removeUselessStrokeAndFill
Expand All @@ -31,3 +32,4 @@ The following plugins are included in `preset-default`, in the order that they a
- removeEmptyContainers
- removeUnusedNS
- [createGroups](./plugins/createGroups.md)
- [cleanupTextElements](./plugins/cleanupTextElements.md)
2 changes: 2 additions & 0 deletions docs/preset-next.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The following plugins are included in `preset-next`, in the order that they are
- minifyStyles
- [cleanupIds](./plugins/cleanupIds.md)
- [minifyColors](./plugins/minifyColors.md)
- [minifyGradients](./plugins/minifyGradients.md)
- [removeUnknownsAndDefaults](./plugins/removeUnknownsAndDefaults.md)
- removeNonInheritableGroupAttrs
- removeUselessStrokeAndFill
Expand All @@ -32,3 +33,4 @@ The following plugins are included in `preset-next`, in the order that they are
- removeEmptyContainers
- removeUnusedNS
- [createGroups](./plugins/createGroups.md)
- [cleanupTextElements](./plugins/cleanupTextElements.md)

0 comments on commit 6064aef

Please sign in to comment.