Demwunz / astro-cookieconsent

Simple to use Cookie Consent for Astro

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vanilla-cookieconent + Astro Integration

Use vanilla-cookieconsent natively in Astro 🍪

Installation

Installation using the Astro CLI

Using the Astro CLI is the recommended way to setup integrations in Astro.

# npm
npx astro add @jop-software/astro-cookieconsent

# pnpm
pnpm astro add @jop-software/astro-cookieconsent

Manual Installation

When the automatic setup from Astro is not an option for you, feel free to install the package manually.

# npm
npm install @jop-software/astro-cookieconsent

# pnpm
pnpm add @jop-software/astro-cookieconsent

Make sure that either your package manager installs peer dependencies or to manually install the vanilla-cookieconsent package.

Usage

// astro.config.mjs

import cookieconsent from "@jop-software/astro-cookieconsent";

export default defineConfig({
    // ...
    integrations: [
        // ...
        cookieconsent({
            // ...
            gui_options: {
                consent_modal: {
                    layout: 'cloud',               // box/cloud/bar
                    position: 'bottom center',     // bottom/middle/top + left/right/center
                    transition: 'slide',           // zoom/slide
                    swap_buttons: false            // enable to invert buttons
                },
                settings_modal: {
                    layout: 'box',                 // box/bar
                    // position: 'left',           // left/right
                    transition: 'slide'            // zoom/slide
                }
            }
            // ...
        }),
    ],
});

When you call the integration, you can use the same configuration as you can in the vanilla-cookieconsent package. Check their Readme for more information and documentation.

Professional support

Professional support is available. Please contact support@jop-software.de for more information.

About

Simple to use Cookie Consent for Astro

License:GNU General Public License v3.0


Languages

Language:TypeScript 100.0%