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
+80Lines changed: 80 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,6 +67,86 @@ 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 the [Advanced Custom Fields](https://wordpress.org/plugins/advanced-custom-fields/) plugin
108
+
- Run `composer install` in the theme via the `afterStart` lifecycle script
109
+
110
+
### URLs and credentials
111
+
112
+
|||
113
+
|---|---|
114
+
| Site |http://localhost:8888|
115
+
| Admin |http://localhost:8888/wp-admin|
116
+
| Username |`admin`|
117
+
| Password |`password`|
118
+
119
+
### Common commands
120
+
121
+
```bash
122
+
# Start the environment
123
+
npx @wordpress/env start # or: wp-env start
124
+
125
+
# Stop containers (data is preserved)
126
+
npx @wordpress/env stop # or: wp-env stop
127
+
128
+
# Remove containers and volumes
129
+
npx @wordpress/env destroy # or: wp-env destroy
130
+
131
+
# Run WP-CLI inside the environment
132
+
npx @wordpress/env run cli wp plugin list
133
+
# or: wp-env run cli wp plugin list
134
+
135
+
# Run a command in the theme directory
136
+
npx @wordpress/env run cli --env-cwd=wp-content/themes/beapi-frontend-framework composer install
137
+
# or: wp-env run cli --env-cwd=wp-content/themes/beapi-frontend-framework composer install
138
+
```
139
+
140
+
### Development workflow
141
+
142
+
With wp-env running, start the Webpack watcher in a second terminal:
143
+
144
+
```bash
145
+
yarn start
146
+
```
147
+
148
+
Changes to PHP, SCSS, and JavaScript assets are reflected after Webpack rebuilds. Theme PHP changes are picked up immediately thanks to the mounted volume.
149
+
70
150
## Configuration
71
151
72
152
The configurations files are in `config` directory.
0 commit comments