@twind/wmr
TypeScript icon, indicating that this package has built-in type declarations

1.0.10 • Public • Published

@twind/wmr Latest Release MIT License

Twind integration for WMR utilizing @twind/preact.

Installation

npm install @twind/wmr

Usage

Edit twind-wmr

-import hydrate from 'preact-iso/hydrate';
+import withTwind from '@twind/wmr';

+const { hydrate, prerender } = withTwind((data) => <App {...data} />)

hydrate(<App />)

-export async function prerender(data) {
-  // we use dynamic import to prevent this from being loaded in the browser:
-  return (await import('preact-iso/prerender')).default(<App {...data} />);
-}
+export { prerender }

Shim-like usage but without the shim

Edit twind-shim-wmr

-import hydrate from 'preact-iso/hydrate';
+import withTwind from '@twind/wmr';

+const { hydrate, prerender } = withTwind({
+  // Options for @twind/preact
+  props: {
+    className: true, // Shim like experience without the shim
+  },
+  /* other twind configuration options */
+}, (data) => <App {...data} />)

hydrate(<App />)

-export async function prerender(data) {
-  // we use dynamic import to prevent this from being loaded in the browser:
-  return (await import('preact-iso/prerender')).default(<App {...data} />);
-}
+export { prerender }

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @twind/wmr

Weekly Downloads

0

Version

1.0.10

License

MIT

Unpacked Size

32.5 kB

Total Files

25

Last publish

Collaborators

  • sastan