@nrsk/astropress
v1.1.0
Published
Astro integration for images and SVG compression.
Downloads
3
Readme
astropress
Astro integration for images and SVG compression.
Features
Basic image and SVG compression integration for Astro 4. Uses:
Installation
First, install the @nrsk/astropress
package using your package manager.
npm install @nrsk/astropress
Then, apply the integration to your astro.config.* file using the integrations
property:
import { defineConfig } from 'astro/config'
import astropress from '@nrsk/astropress'
export default defineConfig({
integrations: [astropress()]
})
[!NOTE]
Place astropress after all other integrations.
Configuration
sharp and svgo are given reasonable defaults, but can be easily configured via the image.options
and svg.options
properties, which accept sharp and svgo options respectively.
Besides that you can specify dir
and out
options to configure the input and output directories.
import { defineConfig } from 'astro/config'
import astropress from '@nrsk/astropress'
export default defineConfig({
integrations: [
astropress({
image: {
dir: '/path/to/input/dir',
out: '/path/to/output/dir',
options // sharp options.
},
svg: {
dir: '/path/to/input/dir',
out: '/path/to/output/dir',
options // svgo options.
}
})
]
})
License
MIT.