Shared utility methods and React components used by our other packages.
npm install @snapwp/coreCore utilities and shared functionality powering SnapWP's composeable framework for Headless WordPress.
> [!WARNING]
> 🐉 There be dragons!
> This project is in active development and considered _experimental_. Some features may be incomplete, unstable, or subject to change.
``bash`
npm install @snapwp/core
`javascript
import { findElementAndGetClassNames } from '@snapwp/core';
const renderedHTML =
'
`javascript
import { generateGraphqlUrl } from '@snapwp/core';const url = generateGraphqlUrl( wpHomeUrl, graphqlEndpoint );
``javascript
import { getClassNamesFromString } from '@snapwp/core';const htmlString = '
';
const classNames = getClassNamesFromString( htmlString ); // [ class1, class2, class3 ]
``javascript
import { getColorClassName } from '@snapwp/core';const colorClassName = getColorClassName( 'red', 'background' ); // has-red-background
`$3
`javascript
import { getConfig } from '@snapwp/core/config';const config = getConfig();
`Contributing
This package is part of SnapWP's monorepo and is actively maintained by rtCamp. Packages are published to npm from the
packages` directory, and can be used standalone in the headless WordPress ecosystem or as part of SnapWP's framework.Contributions are _welcome_ and encouraged! To learn more about contributing to this package or SnapWP as a whole, please read the Contributing Guide.
For development guidelines, please refer to our Development Guide.