npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

astro-consent

v1.0.14

Published

A privacy-first, GDPR-compliant cookie consent banner for Astro with a built-in preferences modal, zero dependencies, and full theme control.

Downloads

1,432

Readme

astro-consent

A privacy-first, zero-dependency cookie consent banner for Astro projects — built for speed, compliance, and total visual control.

Designed and maintained by Velohost.


Why astro-consent?

Most cookie consent solutions are bloated, opaque, or tied to third-party services.

astro-consent is built differently:

  • No trackers
  • No remote calls
  • No analytics SDKs
  • No vendor lock-in
  • No runtime dependencies

Just a fast, deterministic, developer-controlled consent layer that respects user privacy and legal boundaries.


✨ Features

  • ✅ GDPR / UK GDPR friendly
  • 🍪 Consent categories: Essential, Analytics, Marketing
  • 🎛️ Preferences modal with toggle switches
  • ⚡ Zero runtime dependencies
  • 🎨 Fully themeable via CSS variables
  • 🧠 Frontend-controlled script loading
  • 🧩 Native Astro integration
  • 🛠️ CLI installer & remover
  • 🔁 Clean uninstall with no residue
  • 🌍 Framework-agnostic frontend API

📦 Installation (Required)

This package uses both an Astro integration and a CLI installer.

1️⃣ Install the package

npm install astro-consent

This step is required so Astro can import the integration at build time.


2️⃣ Run the installer

npx astro-consent

This will automatically:

  • Inject the Astro integration into astro.config.*
  • Create src/cookiebanner.css for theme control
  • Enable the consent banner across your site

No manual wiring required.


❌ Uninstall

npx astro-consent remove

This cleanly removes:

  • The integration entry
  • Generated files
  • All banner logic

No orphaned config. No hidden state.


🔧 Astro Integration Usage

import astroConsent from "astro-consent";

export default {
  integrations: [
    astroConsent({
      siteName: "My Website",
      policyUrl: "https://example.com/privacy-policy",
      consent: {
        days: 30,
        storageKey: "astro-cookie-consent"
      },
      categories: {
        analytics: false,
        marketing: false
      }
    })
  ]
};

Configuration notes

  • policyUrl
    A full, public URL to your Privacy or Cookie Policy page.
    This is linked directly from the consent banner.

  • consent.days
    How long (in days) consent is stored before the user is asked again.

  • consent.storageKey
    The localStorage key used to persist consent.
    You may change this freely if you need per-site or per-environment isolation.

  • categories.analytics
    Allows analytics scripts to load only after consent.
    Typical use: Plausible, self-hosted analytics, Google Analytics.

  • categories.marketing
    Allows marketing and advertising scripts to load only after consent.
    Typical use: ad pixels, remarketing tags, embedded social trackers.

Scripts outside the essential category must be conditionally loaded.


🧠 Frontend API

window.cookieConsent.get();
window.cookieConsent.set({ essential: true, analytics: true });
window.cookieConsent.reset();

🎨 Theming

All visuals are controlled via:

src/cookiebanner.css

You must ensure this file is included globally.

Recommended import (Astro)

Import the stylesheet once in your main layout or entry file:

import "../cookiebanner.css";

This guarantees the banner styles are available on every page.

  • This file is never overwritten
  • All colours, spacing, radius, and animations are controlled via CSS variables
  • Full visual control with zero JavaScript theming

🔐 Privacy

  • No cookies before consent
  • No tracking without permission
  • No external requests
  • Stored locally with TTL

📄 License

MIT © Velohost


🏢 Velohost

https://velohost.co.uk/