Skip to content

Commit 86200ed

Browse files
authored
Adding CLI reference to Playground README (#2433)
1 parent 0d9262d commit 86200ed

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ Playground aims to facilitate:
1414

1515
- Learning WordPress Through Exploration
1616
- Learning WordPress Development Through Writing Code
17-
- Instant access to WordPress ecosystem
17+
- Instant access to the WordPress ecosystem
1818

1919
Learn more about the [vision](https://github.com/WordPress/wordpress-playground/issues/472) and the [roadmap](https://github.com/WordPress/wordpress-playground/issues/525).
2020

2121
## Getting started
2222

2323
WordPress Playground has a [live demo](https://developer.wordpress.org/playground/demo/) available.
2424

25-
You can embed WordPress Playground in your project via an `<iframe>` – find out how in the [documentation](https://wordpress.github.io/wordpress-playground/). **Note the embed is experimental and may break or change without a warning.**
25+
You can embed WordPress Playground in your project via an `<iframe>` – find out how in the [documentation](https://wordpress.github.io/wordpress-playground/). **Note the embed is experimental and may break or change without warning.**
2626

2727
You can connect to the Playground using the JavaScript client. Here's an example of how to do it in the browser using an `iframe` HTML element and the `startPlaygroundWeb` function from the `@wp-playground/client` package.
2828

@@ -68,6 +68,19 @@ You can connect to the Playground using the JavaScript client. Here's an example
6868
</script>
6969
```
7070

71+
## The Playground CLI
72+
73+
For local development and testing, WordPress Playground offers a command-line interface (CLI) tool: [`@wp-playground/cli`](https://www.npmjs.com/package/@wp-playground/cli). This powerful tool simplifies setting up a local WordPress environment, leveraging the capabilities of WordPress Playground to create zero-setup instances. It's useful for developers, as it allows you to quickly spin up a WordPress site directly in your project directory without complex server configurations, and even switch PHP and WordPress versions with simple flags.
74+
75+
The best part? You can run it directly using `npx`, Node.js's package runner. To get started, navigate to your plugin or theme directory and run:
76+
77+
```bash
78+
cd my-plugin-or-theme-directory
79+
npx @wp-playground/cli server --auto-mount
80+
```
81+
82+
The `--auto-mount` flag detects if your project is a plugin or theme, mounting it automatically into the virtual WordPress environment. This provides an instant, isolated WordPress instance for testing your code. For more advanced usage, including manual mounting options and blueprint integration, refer to the [Playground CLI documentation](https://github.com/WordPress/wordpress-playground/tree/trunk/packages/playground/cli#readme).
83+
7184
## WordPress Playground Tools
7285

7386
WordPress [Playground Tools](https://github.com/WordPress/playground-tools) are independent applications built on top of WordPress Playground. They are located in a different repository: [WordPress/playground-tools](https://github.com/WordPress/playground-tools).
@@ -76,7 +89,6 @@ These tools include:
7689

7790
- [Interactive Code Block for Gutenberg](https://github.com/WordPress/playground-tools/tree/trunk/packages/interactive-code-block/#readme)
7891
- [WordPress Playground for Visual Studio Code](https://github.com/WordPress/playground-tools/tree/trunk/packages/vscode-extension/#readme)
79-
- [@wp-playground/cli](https://github.com/WordPress/wordpress-playground/tree/trunk/packages/playground/cli#readme) CLI local development environment.
8092

8193
## Cloning WordPress Playground repo
8294

0 commit comments

Comments
 (0)