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
Added .wp-env.json and supporting wp-env files for improved local WordPress setup. Updated README with detailed setup instructions and commands. Changed default WordPress port in .env.local.example. Removed obsolete faust-tutorial-blueprint.json. Updated dependencies in package.json and package-lock.json. Improved tutorial documentation in docs/tutorial/learn-faust/index.md.
Copy file name to clipboardExpand all lines: docs/tutorial/learn-faust/index.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ In order to complete this tutorial, you should:
20
20
- Be comfortable running commands on the [command line](https://en.wikipedia.org/wiki/Command-line_interface)
21
21
- Have [Node.js and NPM](https://nodejs.org/) installed on your computer
22
22
23
-
You should also not have any other projects running on port `3000` or `8881`, since the links in this tutorial point to pages on those ports.
23
+
You should also not have any other projects running on port `3000` or `8888`, since the links in this tutorial point to pages on those ports. You'll also need [Docker](https://www.docker.com/) installed and running to use wp-env for the WordPress backend.
- 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.
42
+
- Run `npm run tutorial:setup`. This command uses [`wp-env`](https://developer.wordpress.org/block-editor/getting-started/devenv/get-started-with-wp-env/) to set up a local WordPress environment with Docker. The configuration is defined in the `.wp-env.json`file included in the project.
43
+
-The setup process will install dependencies, start the WordPress environment, and import a pre-configured database.
44
44
45
45
After a moment, you should have a WordPress site up-and-running.
46
46
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.
47
+
By navigating to http://localhost:8888/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
48
49
49
Next, we'll just configure a few last things in WordPress.
50
50
@@ -70,7 +70,7 @@ Follow these steps to set up your Faust.js frontend:
70
70
71
71
```env title=".env.local"
72
72
# Your WordPress site URL
73
-
NEXT_PUBLIC_WORDPRESS_URL=http://localhost:8881
73
+
NEXT_PUBLIC_WORDPRESS_URL=http://localhost:8888
74
74
75
75
# Plugin secret found in WordPress Settings->Faust
76
76
FAUST_SECRET_KEY=ABC123
@@ -166,7 +166,7 @@ export default templates;
166
166
167
167
ThistellsFausttousethe `PageTemplate` componentasthetemplatetorenderpagesthatmatch `page`, according to the template hierarchy.
168
168
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).
169
+
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 +381,7 @@ You should now be able to visit http://localhost:3000/blog/hello-world/ and see
381
381
382
382
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
383
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.
384
+
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
385
386
386
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