When contributing to WordPress core and/or Gutenberg you may find yourself in a situation when you want to open pull requests to both WordPress/wordpress-develop and WordPress/gutenberg.
Typically most peoples local environments consist of a local development tool such as LocalWP or Studio but these come with their own managed versions of WordPress, not the Github repository you’d need to version control yourself to open pull requests. This was a problem I found myself in recently whilst working on a project, and fortunately I found a solution that works pretty well for me.
Prerequisites
- npm install
@wordpress/envglobally. - Install Docker.
- Fork, checkout, install and build the WordPress/wordpress-develop repo.
- Fork, checkout, install and build the WordPress/gutenberg repo.
My folder structure its like below:
- Projects
-- wordpress-develop
-- gutenberg
-- wp-envPlaintextSetup
- Create an empty
wp-envdirectory alongside yourwordpress-developandgutenbergdirectories. - Inside the
wp-envdirectory create a file called.wp-env.override.json - Add the following contents to this file:
{
"core": "../wordpress-develop/src",
"mappings": {
"wp-content/plugins/gutenberg": "../gutenberg"
}
}JSONAnd that’s it.
Now navigation via the terminal into your wp-env directory and run wp-env start.
This will create a WordPress environment that uses your WordPress and Gutenberg git codebases specified in .wp-env.override.json
Leave a Reply