You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds experimental SVGO optimization support for SVG assets
6
+
7
+
Astro now supports automatic SVG optimization using SVGO during build time. This experimental feature helps reduce SVG file sizes while maintaining visual quality, improving your site's performance.
8
+
9
+
To enable SVG optimization with default settings, add the following to your `astro.config.mjs`:
10
+
```js
11
+
import { defineConfig } from'astro/config';
12
+
13
+
exportdefaultdefineConfig({
14
+
experimental: {
15
+
svgo:true,
16
+
},
17
+
});
18
+
```
19
+
20
+
To customize optimization, pass a [SVGO configuration object](https://svgo.dev/docs/plugins/):
21
+
22
+
```js
23
+
exportdefaultdefineConfig({
24
+
experimental: {
25
+
svgo: {
26
+
plugins: [
27
+
'preset-default',
28
+
{
29
+
name:'removeViewBox',
30
+
active:false
31
+
}
32
+
],
33
+
},
34
+
},
35
+
});
36
+
```
37
+
38
+
For more information on enabling and using this feature in your project, see the [experimental SVG optimization docs](https://docs.astro.build/en/reference/experimental-flags/svg-optimization/).
`Invalid or outdated experimental feature.\nCheck for incorrect spelling or outdated Astro version.\nSee https://docs.astro.build/en/reference/experimental-flags/ for a list of all current experiments.`,
* See the [experimental Chrome DevTools workspace feature documentation](https://docs.astro.build/en/reference/experimental-flags/chrome-devtools-workspace/) for more information.
2538
2539
*/
2539
2540
chromeDevtoolsWorkspace?: boolean;
2541
+
2542
+
/**
2543
+
* @name experimental.svgo
2544
+
* @type {boolean | SvgoConfig}
2545
+
* @default `false`
2546
+
* @description
2547
+
* Enable SVG optimization using SVGO during build time.
2548
+
*
2549
+
* Set to `true` to enable optimization with default settings, or pass a configuration
2550
+
* object to customize SVGO behavior.
2551
+
*
2552
+
* When enabled, all imported SVG files will be optimized for smaller file sizes
2553
+
* and better performance while maintaining visual quality.
2554
+
*
2555
+
* ```js
2556
+
* {
2557
+
* experimental: {
2558
+
* // Enable with defaults
2559
+
* svgo: true
2560
+
* }
2561
+
* }
2562
+
* ```
2563
+
*
2564
+
* To customize optimization, pass a [SVGO configuration object](https://svgo.dev/):
2565
+
*
2566
+
* ```js
2567
+
* {
2568
+
* experimental: {
2569
+
* svgo: {
2570
+
* plugins: [
2571
+
* 'preset-default',
2572
+
* {
2573
+
* name: 'removeViewBox',
2574
+
* active: false
2575
+
* }
2576
+
* ]
2577
+
* }
2578
+
* }
2579
+
* }
2580
+
* ```
2581
+
*
2582
+
* See the [experimental SVGO optimization docs](https://docs.astro.build/en/reference/experimental-flags/svg-optimization/) for more information.
0 commit comments