You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+80-1Lines changed: 80 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,6 +67,85 @@ Alternatively, you can use NPM.
67
67
npm install
68
68
```
69
69
70
+
## Local development with wp-env
71
+
72
+
BFF ships with a [wp-env](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/) configuration (`.wp-env.json`) to run a local WordPress instance with Docker.
73
+
74
+
### Requirements
75
+
76
+
-[Docker Desktop](https://www.docker.com/products/docker-desktop/) (or a compatible Docker runtime)
77
+
- Node.js (see [Requirements](#nodejs))
78
+
79
+
### Installing wp-env
80
+
81
+
You can run wp-env without a global install via `npx @wordpress/env`, or install the CLI once and use the `wp-env` command:
82
+
83
+
```bash
84
+
# Global install (npm or yarn)
85
+
npm install -g @wordpress/env
86
+
# or
87
+
yarn global add @wordpress/env
88
+
```
89
+
90
+
After installation, replace `npx @wordpress/env` with `wp-env` in the commands below.
91
+
92
+
### Getting started
93
+
94
+
From the theme root:
95
+
96
+
```bash
97
+
yarn
98
+
npx @wordpress/env start
99
+
# or, if wp-env is installed globally:
100
+
wp-env start
101
+
```
102
+
103
+
On first start, wp-env will:
104
+
105
+
- Spin up WordPress (PHP 8.3)
106
+
- Mount this theme from the current directory
107
+
- Install and activate the [Advanced Custom Fields](https://wordpress.org/plugins/advanced-custom-fields/) plugin
108
+
109
+
### URLs and credentials
110
+
111
+
|||
112
+
|---|---|
113
+
| Site |http://localhost:8888|
114
+
| Admin |http://localhost:8888/wp-admin|
115
+
| Username |`admin`|
116
+
| Password |`password`|
117
+
118
+
### Common commands
119
+
120
+
```bash
121
+
# Start the environment
122
+
npx @wordpress/env start # or: wp-env start
123
+
124
+
# Stop containers (data is preserved)
125
+
npx @wordpress/env stop # or: wp-env stop
126
+
127
+
# Remove containers and volumes
128
+
npx @wordpress/env destroy # or: wp-env destroy
129
+
130
+
# Run WP-CLI inside the environment
131
+
npx @wordpress/env run cli wp plugin list
132
+
# or: wp-env run cli wp plugin list
133
+
134
+
# Run a command in the theme directory
135
+
npx @wordpress/env run cli --env-cwd=wp-content/themes/beapi-frontend-framework composer install
136
+
# or: wp-env run cli --env-cwd=wp-content/themes/beapi-frontend-framework composer install
137
+
```
138
+
139
+
### Development workflow
140
+
141
+
With wp-env running, start the Webpack watcher in a second terminal:
142
+
143
+
```bash
144
+
yarn start
145
+
```
146
+
147
+
Changes to PHP, SCSS, and JavaScript assets are reflected after Webpack rebuilds. Theme PHP changes are picked up immediately thanks to the mounted volume.
148
+
70
149
## Configuration
71
150
72
151
The configurations files are in `config` directory.
@@ -130,4 +209,4 @@ function customize_editor_settings( $settings ) {
0 commit comments