1.1.0 • Published 1 year ago

@nrsk/astropress v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

astropress

Build/Test NPM Semantic Release Conventional Commits

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.

1.1.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago