Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [2.1.0]

### Changed

- Core Framework now requires WordPress 6.6 or newer. The block editor integration is built against the `react-jsx-runtime` script that WordPress first ships in 6.6. Sites on WordPress 6.0 to 6.5 should stay on Core Framework 2.0.2.

### Fixed

- Fixed the block editor going blank with the Core Framework Gutenberg integration enabled. The editor script was loaded with an outdated, hard-coded dependency list that left out WordPress's `react-jsx-runtime`, so rendering the Core Framework class panel threw on an undefined `ReactJSXRuntime` and took the whole editor down. The script now loads the dependencies its build declares.

## [2.0.2] - 2026-08-28

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Core Framework is a visual CSS framework and design-token builder for the web, W
[![GitHub stars](https://img.shields.io/github/stars/corebunch/core-framework?style=flat&label=stars&labelColor=171923&color=ffd43b)](https://github.com/corebunch/core-framework/stargazers)
[![License: MIT](https://img.shields.io/badge/license-MIT-5c62ff?labelColor=171923)](LICENSE)
[![Runtime: Bun](https://img.shields.io/badge/runtime-Bun-f9f1e1?labelColor=171923)](https://bun.sh)
[![WordPress](https://img.shields.io/badge/WordPress-6.0%2B-21759b?labelColor=171923)](https://wordpress.org/plugins/core-framework/)
[![WordPress](https://img.shields.io/badge/WordPress-6.6%2B-21759b?labelColor=171923)](https://wordpress.org/plugins/core-framework/)

[Website](https://coreframework.com) · [Product tour](#product-tour) · [Quick start](#quick-start) · [Documentation](https://docs.coreframework.com) · [Contributing](CONTRIBUTING.md) · [Marketplace](https://coreframework.com/marketplace)

Expand Down Expand Up @@ -219,7 +219,7 @@ Then publish `packages/www/dist` at the matching path, such as `https://example.

## WordPress development

Requirements: WordPress 6.0 or newer, PHP 8.0 or newer, Composer, Bun 1.3.x, and a local HTTPS certificate.
Requirements: WordPress 6.6 or newer, PHP 8.0 or newer, Composer, Bun 1.3.x, and a local HTTPS certificate.

1. Link the plugin package into your WordPress installation:

Expand Down
99 changes: 99 additions & 0 deletions packages/wp/Tests/GutenbergEnqueueTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?php

use CoreFramework\App\Gutenberg\Functions as GutenbergFunctions;
use PHPUnit\Framework\TestCase;

if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', __DIR__ . '/' );
}

if ( ! defined( 'CORE_FRAMEWORK_ABSOLUTE' ) ) {
define( 'CORE_FRAMEWORK_ABSOLUTE', dirname( __DIR__ ) . '/core-framework.php' );
}

if ( ! function_exists( 'apply_filters' ) ) {
function apply_filters( $hook_name, $value ) {
return $value;
}
}

if ( ! function_exists( 'get_file_data' ) ) {
function get_file_data( $file, $headers, $context = '' ) {
return array_merge( array_fill_keys( array_keys( $headers ), '' ), array( 'version' => '0.0.0-test' ) );
}
}

if ( ! function_exists( 'plugin_dir_path' ) ) {
function plugin_dir_path( $file ) {
return rtrim( dirname( $file ), '/\\' ) . '/';
}
}

if ( ! function_exists( 'plugins_url' ) ) {
function plugins_url( $path = '', $plugin = '' ) {
return 'https://example.test/wp-content/plugins/core-framework/' . ltrim( $path, '/' );
}
}

if ( ! function_exists( 'wp_enqueue_script' ) ) {
function wp_enqueue_script( $handle, $src = '', $deps = array(), $ver = false, $args = array() ) {
$GLOBALS['cf_test_enqueued_scripts'][ $handle ] = array(
'src' => $src,
'deps' => $deps,
'ver' => $ver,
);
}
}

final class CoreFrameworkGutenbergEnqueueTestPlugin {
public function enqueue_core_framework_connector(): void {}

public function isDev(): bool {
return false;
}
}

if ( ! function_exists( 'CoreFramework' ) ) {
function CoreFramework() {
return new CoreFrameworkGutenbergEnqueueTestPlugin();
}
}

final class GutenbergEnqueueTest extends TestCase {
private const HANDLE = 'core-framework-gutenberg-plugin';

protected function setUp(): void {
$GLOBALS['cf_test_enqueued_scripts'] = array();
}

private function enqueue(): array {
( new GutenbergFunctions() )->enqueue_scripts();

$this->assertArrayHasKey( self::HANDLE, $GLOBALS['cf_test_enqueued_scripts'] );

return $GLOBALS['cf_test_enqueued_scripts'][ self::HANDLE ];
}

private function manifest(): array {
return require dirname( __DIR__ ) . '/gutenberg/index.asset.php';
}

public function test_bundle_declares_the_jsx_runtime_it_calls(): void {
$bundle = file_get_contents( dirname( __DIR__ ) . '/gutenberg/index.js' );

$this->assertStringContainsString( 'ReactJSXRuntime', $bundle );
$this->assertContains( 'react-jsx-runtime', $this->manifest()['dependencies'] );
}

public function test_enqueue_depends_on_the_jsx_runtime(): void {
$this->assertContains( 'react-jsx-runtime', $this->enqueue()['deps'] );
}

public function test_enqueue_uses_the_shipped_asset_manifest(): void {
$script = $this->enqueue();
$manifest = $this->manifest();

$this->assertSame( $manifest['dependencies'], $script['deps'] );
$this->assertSame( $manifest['version'], $script['ver'] );
}
}
2 changes: 1 addition & 1 deletion packages/wp/core-framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* License: MIT
* License URI: https://opensource.org/license/mit
* Requires PHP: 8.0
* Requires at least: 6.0
* Requires at least: 6.6
* Namespace: CoreFramework
*/

Expand Down
2 changes: 1 addition & 1 deletion packages/wp/readme.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
=== Core Framework ===
Contributors: coreframework
Tags: css, framework, stylesheet, bricks, oxygen
Requires at least: 6.0
Requires at least: 6.6
Requires PHP: 8.0
Tested up to: 7.0
Stable tag: 2.0.2
Expand Down
26 changes: 21 additions & 5 deletions packages/wp/wp/App/Gutenberg/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,17 +262,33 @@ public function add_colors( $theme_json ) {
public function enqueue_scripts() {
CoreFramework()->enqueue_core_framework_connector();

$version = $this->plugin->version();
$script_path = plugin_dir_path( CORE_FRAMEWORK_ABSOLUTE ) . 'gutenberg/index.js';
$script_asset_path = plugin_dir_path( CORE_FRAMEWORK_ABSOLUTE ) . 'gutenberg/index.asset.php';
$script_asset = array(
'dependencies' => array(
'react',
'react-jsx-runtime',
'wp-block-editor',
'wp-components',
'wp-compose',
'wp-data',
'wp-element',
'wp-plugins',
),
'version' => \file_exists( $script_path )
? \filemtime( $script_path )
: $this->plugin->version(),
);

if ( \file_exists( plugin_dir_path( CORE_FRAMEWORK_ABSOLUTE ) . 'gutenberg/index.js' ) ) {
$version = \filemtime( plugin_dir_path( CORE_FRAMEWORK_ABSOLUTE ) . 'gutenberg/index.js' );
if ( \file_exists( $script_asset_path ) ) {
$script_asset = require $script_asset_path;
}

wp_enqueue_script(
'core-framework-gutenberg-plugin',
plugins_url( 'gutenberg/index.js', CORE_FRAMEWORK_ABSOLUTE ),
array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor' ),
$version,
$script_asset['dependencies'],
$script_asset['version'],
true
);
}
Expand Down
Loading