3.1.2 • Published 2 months ago

@joist/ssr v3.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

SSR (Experimental)

Render ShadowDOM on thee server with Declarative Shadow DOM. Parses HTML and recursively inserts user defined templates. The most important part of this would be the template loader. A template loader is an object that defines how the applicator will get the string values for both the html and the css. (css is optional).

import { Applicator. NoopTemplateCache, FileSysTemplateLoader } from '@joist/ssr';

// Define a template caching strategy and a template loader
const applicator = new Applicator(
  new NoopTemplateCache(),
  new FileSysTemplateLoader(
    (tag) => `elements/${tag}/${tag}.html`,
    (tag) => `elements/${tag}/${tag}.css`
  )
);

// Apply to a document and provide a list of elements to search for
applicator.apply(document, [])

Vite

import { Applicator. NoopTemplateCache, FileSysTemplateLoader } from '@joist/ssr';
import { defineConfig } from 'vite';

const applicator = new Applicator(
  new NoopTemplateCache(),
  new FileSysTemplateLoader(
    (tag) => `elements/${tag}/${tag}.html`,
    (tag) => `elements/${tag}/${tag}.css`
  )
);

export default defineConfig({
  plugins: [
    {
      transformIndexHtml: {
        enforce: "pre",
        transform(html) {
          return applicator.apply(html, ['my-element', 'my-dropdown']);
        }
      }
    }
  ],
});
3.1.2

2 months ago

3.1.1

2 months ago

3.1.0

2 months ago

3.0.8-next.0

3 months ago

3.0.8-next.1

2 months ago

3.0.0-next.19

11 months ago

3.0.0-next.18

11 months ago

3.0.4

6 months ago

3.0.7

6 months ago

3.0.6

8 months ago

3.0.0

8 months ago

3.0.0-next.20

11 months ago

3.0.0-rc.2

11 months ago

3.0.0-rc.1

11 months ago

3.0.0-next.11

12 months ago

3.0.0-next.10

12 months ago

3.0.0-next.13

12 months ago

3.0.0-next.12

12 months ago

3.0.0-next.2

12 months ago

3.0.0-next.1

12 months ago

3.0.0-next.4

12 months ago

3.0.0-next.3

12 months ago

3.0.0-next.15

12 months ago

3.0.0-next.14

12 months ago

3.0.0-next.16

12 months ago

3.0.0-next.9

12 months ago

3.0.0-next.6

12 months ago

3.0.0-next.5

12 months ago

3.0.0-next.8

12 months ago

3.0.0-next.7

12 months ago

3.0.0-2

12 months ago