Spinning Up a WordPress Local Environment with 10up WP-Scaffold and @wordpress/env
While researching starter themes for WordPress Block-based Themes, I came across the 10up wp-scaffold. I decided to try spinning up an environment using the @wordpress/env tool (which I have not done before). Even though 10up provided instructions for installation, I still ran into some issues due to not being familiar with how wp-env works. Below are the steps I took to get this successfully up and running.
Resources
- 10up wp-scaffold repo
- Guides for using wp-env:
Prerequisites/Set up
- Make sure these are installed on your machine:
- A Github account, with your machine’s ssh key added to your account.
- Once Docker is running, install the wp-env package globally
- Using terminal, run:
npm -g i @wordpress/env
- Using terminal, run:
Steps for spinning up the 10up wp-scaffold
- Create a project folder on your machine and add a wp-content folder inside
- Using terminal, cd into /wp-content
- Within /wp-content, run:
-
npx 10up-toolkit project init
Note: I ran into some issues with my node and npm versions, I ended up switching Node to version 20 and npm to version 10.
-
- Answer the following prompts:
- Create a project name: {what ever you want}
- Project template: Standard WP
- CI type: None
- cd into themes/wpscaffold10up-block-theme
- In the theme folder /wpscaffold10up-block-theme, run:
composer install
- In the theme folder /wpscaffold10up-block-theme, run:
-
wp-env start
-
- Once the Docker environment is set up, login to the WordPress admin and activate the “WpScaffold10up Block Theme”
- Login: http://localhost:8888/wp-admin
- Un: admin
- Pw: password
To edit the theme files:
- Download /node_modules folder: cd into the theme folder and run:
npm install
- Note: You might need to install husky separately
- Run:
npm install husky --save-dev
- Again, run:
npm install
- Run:
- Run
npm start
to start watching for changes - Note: if you run into issues during npm install or start, you might need to change your node and npm versions (I was successful when I used node v20 and npm v10)
Comments
Add comment about the post