Skip to content

Commit c07baf2

Browse files
authored
Apply suggestions from code review
1 parent 71abfa9 commit c07baf2

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

examples/next/wp-theme-rendered-blocks/README.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,22 @@ import '@/styles/globals.css'; // Optional custom app styles
5656

5757
1. Node.js 18.18 or later
5858
2. npm or another package manager
59-
3. WPGraphql
60-
4. HWP Global Stylesheet Plugin
59+
3. WPGraphql (included in wp-env setup)
60+
4. HWP Global Stylesheet Plugin (included in wp-env setup)
61+
5. [Docker](https://www.docker.com/) (if you plan on running the example see details below)
62+
63+
**Note** Please make sure you have all prerequisites installed as mentioned above and Docker running (`docker ps`)
6164

6265
### Clone the repository
6366

6467
```bash
6568
git clone https://github.com/wpengine/hwptoolkit.git
66-
cd examples/next/render-blocks-pages-router
6769
```
6870

6971
### Install dependencies
7072

7173
```bash
72-
npm install
74+
`cd hwptoolkit && npm install`
7375
```
7476

7577
### Build and start the application

examples/next/wp-theme-rendered-blocks/example-app/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
"build": "next build",
88
"start": "next start",
99
"lint": "next lint",
10-
"prettier": "prettier --write ."
10+
"prettier": "prettier --write .",
11+
"styles:fetch": "node scripts/fetchWpGlobalStyles.js"
12+
1113
},
1214
"dependencies": {
1315
"@wordpress/base-styles": "^5.21.0",

examples/next/wp-theme-rendered-blocks/example-app/scripts/fetchWpGlobalStyles.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const fs = require('fs');
22
const path = require('path');
3-
const fetch = require('node-fetch'); // make sure node-fetch is installed
43

54
async function fetchWpGlobalStyles(endpoint, outputPath = 'styles/hwp-global-styles.css', types = ['variables', 'presets', 'styles', 'base-layout-styles']) {
65
const typeEnums = types.map(type => type.toUpperCase().replace(/-/g, '_'));
@@ -41,3 +40,5 @@ async function fetchWpGlobalStyles(endpoint, outputPath = 'styles/hwp-global-sty
4140
console.error('Error fetching global styles:', error.message);
4241
}
4342
}
43+
44+
fetchWpGlobalStyles("http://localhost:8888/graphql")

examples/next/wp-theme-rendered-blocks/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"version": "0.1.0",
44
"description": "An example headless WordPress application using Global Styles from WordPress using WPGraphQL.",
55
"scripts": {
6-
"example:build": "pnpm run wp:images:unzip && pnpm run example:dev:install && pnpm run wp:start && pnpm run wp:db:import && pnpm run example:start",
6+
"example:build": "pnpm run example:dev:install && pnpm run wp:start && pnpm run wp:db:import && pnpm run example:start && pnpm run example:styles:fetch",
7+
"example:styles:fetch": "cd example-app && pnpm run styles:fetch",
78
"example:dev:install": "cd example-app && npm install && cd ..",
89
"example:start": "pnpm run wp:start && pnpm run example:dev",
910
"example:stop": "pnpm run wp:stop",

0 commit comments

Comments
 (0)