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
chore: Switch tutorial to use wp-env and Docker (#2221)
* Switch tutorial to use wp-env and Docker
Replaces wp-now and blueprint setup with @wordpress/env and Docker for local WordPress development in the Faust.js tutorial. Updates documentation, environment example, and removes faust-tutorial-blueprint.json in favor of .wp-env.json. Changes all references and ports from 8881 to 8888 for consistency.
* npx degit wpengine/faustjs/examples/next/tutorial#issue-2211 faust-tutorial
* remove accidental directory
* Delete tutorial-wp-env-migration.md
- Run `npm run wp-dev`. This command uses the [`wp-now`](https://www.npmjs.com/package/@wp-now/wp-now) NPM package and the included [`faust-tutorial-blueprint.json`](https://github.com/wpengine/faustjs/blob/canary/examples/next/tutorial/faust-tutorial-blueprint.json) blueprint file to set up a local WordPress environment.
43
-
-When asked if it's okay to install the `@wp-now/wp-now` package, answer `y`to confirm.
43
+
- Run `npm install` to install dependencies, including the [`@wordpress/env`](https://developer.wordpress.org/block-editor/getting-started/devenv/get-started-with-wp-env/) package.
44
+
-Run `npm run wp-dev`to start the local WordPress environment using wp-env. This will use Docker to create a WordPress instance with the required plugins.
44
45
45
46
After a moment, you should have a WordPress site up-and-running.
46
47
47
-
By navigating to http://localhost:8881/wp-admin/plugins.php, You can see that the required [FaustWP](https://wordpress.org/plugins/faustwp/) and [WPGraphQL](https://wordpress.org/plugins/wp-graphql/) plugins have already been installed for you.
48
+
By navigating to http://localhost:8888/wp-admin, you can access the WordPress admin. The default credentials are:
49
+
- Username: `admin`
50
+
- Password: `password`
51
+
52
+
You can see that the required [FaustWP](https://wordpress.org/plugins/faustwp/) and [WPGraphQL](https://wordpress.org/plugins/wp-graphql/) plugins have already been installed for you by checking http://localhost:8888/wp-admin/plugins.php.
48
53
49
54
Next, we'll just configure a few last things in WordPress.
50
55
@@ -70,7 +75,7 @@ Follow these steps to set up your Faust.js frontend:
70
75
71
76
```env title=".env.local"
72
77
# Your WordPress site URL
73
-
NEXT_PUBLIC_WORDPRESS_URL=http://localhost:8881
78
+
NEXT_PUBLIC_WORDPRESS_URL=http://localhost:8888
74
79
75
80
# Plugin secret found in WordPress Settings->Faust
76
81
FAUST_SECRET_KEY=ABC123
@@ -166,7 +171,7 @@ export default templates;
166
171
167
172
ThistellsFausttousethe `PageTemplate` componentasthetemplatetorenderpagesthatmatch `page`, according to the template hierarchy.
168
173
169
-
Save your changes and visit [http://localhost:3000/sample-page/](http://localhost:3000/sample-page/) inabrowser. Youshouldbeabletoseethetitleandcontentforthe [SamplePagepageinWordPress](http://localhost:8881/wp-admin/post.php?post=2&action=edit).
174
+
Save your changes and visit [http://localhost:3000/sample-page/](http://localhost:3000/sample-page/) inabrowser. Youshouldbeabletoseethetitleandcontentforthe [SamplePagepageinWordPress](http://localhost:8888/wp-admin/post.php?post=2&action=edit).
@@ -381,7 +386,7 @@ You should now be able to visit http://localhost:3000/blog/hello-world/ and see
381
386
382
387
Inspect the blog post content in the browser dev tools and notice that each block is being rendered and that only the paragraph blocks are wrapped in a `div`with a classnameof`paragraph-block-wrapper`. Currently, we're not leveraging the `paragraph-block-wrapper` class in any way, but you can see the potential here. By being able to query for and render blocks individually, you have the ability to wrap specific blocks in arbitrary markup, override specific blocks with custom implementations, and more.
383
388
384
-
Now [edit the Hello World! blog post](http://localhost:8881/wp-admin/post.php?post=1&action=edit). Make several changes to it in terms of font size, padding, margin, a border, an HTML anchor, and additional CSS classes, then save your changes.
389
+
Now [edit the Hello World! blog post](http://localhost:8888/wp-admin/post.php?post=1&action=edit). Make several changes to it in terms of font size, padding, margin, a border, an HTML anchor, and additional CSS classes, then save your changes.
385
390
386
391
Reload the http://localhost:3000/blog/hello-world/ page in your frontend app and see that all the changes you applied are now being reflected. Inspect the paragraph block in DevTools to see markup similar to the example below. You can see that Faust has taken care of rendering the paragraph tag to include these attributes, and even loaded the CSS required to apply the correct styles.
0 commit comments