0.4.0 • Published 2 months ago

@snapwp/core v0.4.0

Weekly downloads
-
License
AGPL-3.0
Repository
-
Last release
2 months ago

@snapwp/core

Core 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.

Installation

npm install @snapwp/core

Usage

Utils

import { findElementAndGetClassNames } from '@snapwp/core';

const renderedHTML =
	'<div class="class1"><div class="class2" id="div-2"></div></div>';
const classNames = findElementAndGetClassNames( renderedHTML, '#div-2' ); // class2
import { generateGraphqlUrl } from '@snapwp/core';

const url = generateGraphqlUrl( wpHomeUrl, graphqlEndpoint );
import { getClassNamesFromString } from '@snapwp/core';

const htmlString = '<div class="class1 class2 class3"></div>';
const classNames = getClassNamesFromString( htmlString ); // [ class1, class2, class3 ]
import { getColorClassName } from '@snapwp/core';

const colorClassName = getColorClassName( 'red', 'background' ); // has-red-background

Config Manager

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.

Want to expand what's possible with WordPress?

0.4.0

2 months ago

0.3.1

3 months ago

0.3.0

3 months ago

0.2.1

4 months ago

0.2.0

4 months ago

0.1.0

5 months ago

0.0.2

5 months ago

0.0.1

5 months ago