@nrsk/astropress
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

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.

/@nrsk/astropress/

    Package Sidebar

    Install

    npm i @nrsk/astropress

    Weekly Downloads

    0

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    55.4 kB

    Total Files

    9

    Last publish

    Collaborators

    • norskeld