Skip to content

An Astro integration for SSR Web Components using WCC

Notifications You must be signed in to change notification settings

ProjectEvergreen/astro-wcc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

astro-wcc

An Astro integration for SSR Web Components using WCC.

Usage

  1. Install the plugin into your Astro project
    $ npm i @projectevergreen/astro-wcc
  2. Then add it to your Astro configuration file
    import { defineConfig } from 'astro/config';
    import astroWcc from '@projectevergreen/astro-wcc';
    
    export default defineConfig({
      integrations: [ astroWcc() ]
    });
  3. You can now use a component in an Astro file
    <!-- src/pages/index.astro -->
    <html lang="en">
      <head>
        <script src="../components/greeting.js"></script>
      </head>
      <body>
        <x-greeting></x-greeting>
      </body>
    </html>

Caveats

  • Currently assumes <x-${tagName}> maps to src/components/${tagName}.js
  • Client hints (e.g. <x-greeting client:visible>) are not supported

About

An Astro integration for SSR Web Components using WCC

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published