diff --git a/docs/getting-started.md b/docs/getting-started.md index 34c2e071..f2cc32e4 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -7,7 +7,7 @@ This guide will walk you through setting up a headless WordPress app using SnapW ### Prerequisites - **PHP**: v7.4+ -- **WordPress**: v6.0+ +- **WordPress**: v6.7+ - A **[Block Theme](https://wordpress.org/documentation/article/block-themes/)** ### Installation Steps diff --git a/packages/next/README.md b/packages/next/README.md index d1533dcc..8ed91a90 100644 --- a/packages/next/README.md +++ b/packages/next/README.md @@ -167,16 +167,16 @@ export default function ScriptModuleExample() { + dependencies={[ + { + importType: 'static', + connectedScriptModule: { + handle: '@module', + src: 'http://example.com/index.min.js' + } + } + ]} + /> ); } @@ -207,6 +207,38 @@ export default function CustomFonts() { } ``` +### `getGlobalStyles()` + +Global styles can be modified by passing the `getGlobalStyles` attribute to the [RootLayout](./src/root-layout/index.tsx) within the `src/app/layout.tsx` file of the frontend application. + +`getGlobalStyles` takes an async callback function that returns an object containing global styles. + +The default definition for `getGlobalStyles` function passed in `getGlobalStyles` attribute can be found in [@snapwp/query](../packages/query/README.md) package. + +Type Definition of `getGlobalStyles`: + +```typescript +type getGlobalStyles = () => Promise< GlobalHeadProps >; +``` + +Type definition of `GlobalHeadProps` can be found in [@snapwp/core](../packages/core/README.md) package. + +### `getTemplateData()` + +Template data can be modified by passing `getTemplateData` attribute to the [TemplateRenderer](./src/template-renderer/index.tsx) within `src/app/[[...path]]/page.tsx` file of the frontend application. + +`getTemplateData` takes an async callback to get template styles and content. + +The default definition for `getTemplateData` function passed in `getTemplateData` attribute can be found in [@snapwp/query](../packages/query/README.md) package. + +Type Definition of `getTemplateData`: + +```typescript +type getTemplateData = ( uri: string ) => Promise< TemplateData >; +``` + +Type definition of `TemplateData` can be found in [@snapwp/core](../packages/core/README.md) package. + ## Contributing This package is part of [SnapWP's monorepo](https://github.com/rtCamp/snapwp) and is actively maintained by [rtCamp](https://rtcamp.com/). Packages are published to [npm](https://www.npmjs.com/) from the `packages` directory, and can be used standalone in the headless WordPress ecosystem or as part of SnapWP's framework.