saadeghi / theme-change

Change CSS theme with toggle, buttons or select using CSS custom properties and localStorage
https://codepen.io/saadeghi/pen/OJypbNM
MIT License
1.42k stars 46 forks source link

Support for Astro 3 #45

Closed Eliaz-LR closed 1 year ago

Eliaz-LR commented 1 year ago

Hi, the part of the doc on Astro needs updating to support the transition API included in Astro v3.

Eliaz-LR commented 1 year ago

You should just have to add a line

    <script>
      import { themeChange } from 'theme-change';
      themeChange();
      document.addEventListener('astro:after-swap',themeChange)
      // 👆 you could import the CDN directly instead of these two lines
    </script>