Skip to content

Commit

Permalink
Use wp_register_block_metadata_collection for block metadata perf imp…
Browse files Browse the repository at this point in the history
…rovements
  • Loading branch information
adamwoodnz committed Oct 23, 2024
1 parent 034722c commit 9854f56
Show file tree
Hide file tree
Showing 5 changed files with 1,923 additions and 546 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ jobs:
yarn
- name: Build
run: yarn workspaces run build
run: |
yarn build
yarn build:theme:blocks-manifest
- name: Trim the repo down to just the theme
run: |
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": "GPL-2.0-or-later",
"private": true,
"dependencies": {
"@wordpress/scripts": "27.1.0"
"@wordpress/scripts": "30.3.0"
},
"devDependencies": {
"@wordpress/env": "9.2.0"
Expand All @@ -20,6 +20,7 @@
"wp-env": "wp-env",
"build": "yarn workspaces run build",
"build:theme": "yarn workspace wporg-developer-2023 build",
"build:theme:blocks-manifest": "yarn workspace wporg-developer-2023 build-blocks-manifest",
"start:theme": "yarn workspace wporg-developer-2023 start",
"lint:css": "wp-scripts lint-style"
},
Expand Down
5 changes: 5 additions & 0 deletions source/wp-content/themes/wporg-developer-2023/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@
require __DIR__ . '/inc/block-hooks.php';

// Block files
wp_register_block_metadata_collection(
__DIR__ . '/build',
__DIR__ . '/build/blocks-manifest.php'
);

require_once __DIR__ . '/src/cli-command-table/block.php';
require_once __DIR__ . '/src/code-changelog/block.php';
require_once __DIR__ . '/src/code-deprecated/block.php';
Expand Down
3 changes: 2 additions & 1 deletion source/wp-content/themes/wporg-developer-2023/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"private": true,
"devDependencies": {
"@wordpress/eslint-plugin": "^17.7.0",
"@wordpress/scripts": "27.1.0"
"@wordpress/scripts": "30.3.0"
},
"eslintConfig": {
"extends": "../../../../.eslintrc.js"
Expand All @@ -17,6 +17,7 @@
},
"scripts": {
"build": "wp-scripts build",
"build-blocks-manifest": "wp-scripts build-blocks-manifest",
"start": "wp-scripts start",
"lint:js": "wp-scripts lint-js src",
"lint:css": "wp-scripts lint-style *.css src/**/*.scss",
Expand Down
Loading

0 comments on commit 9854f56

Please sign in to comment.