Skip to content

docs: Next.js WP Theme rendered blocks #115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

whoami-pwd
Copy link
Contributor

@whoami-pwd whoami-pwd commented Mar 25, 2025

Issue

Provides an example of fetching WP Global Stylesheet:

  • An example WP Plugin
  • An example WP Global Stylesheet Fetching Script
  • Description in READM.md

@whoami-pwd whoami-pwd changed the title Example: Next.js WP Theme rendered blocks feat: Next.js WP Theme rendered blocks comand Mar 25, 2025
@whoami-pwd whoami-pwd marked this pull request as ready for review March 27, 2025 09:46
@whoami-pwd whoami-pwd requested a review from a team as a code owner March 27, 2025 09:46
Copy link
Member

@moonmeister moonmeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@whoami-pwd whoami-pwd changed the title feat: Next.js WP Theme rendered blocks comand feat: Next.js WP Theme rendered blocks Apr 3, 2025
Copy link
Member

@moonmeister moonmeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be its own example, not a modification of a previous example. Thanks.

Copy link
Member

@moonmeister moonmeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good, I'm not seeing a wp-env setup though.

@moonmeister moonmeister changed the title feat: Next.js WP Theme rendered blocks docs: Next.js WP Theme rendered blocks Apr 8, 2025
@whoami-pwd whoami-pwd requested a review from moonmeister April 11, 2025 15:32
Copy link
Member

@colinmurphy colinmurphy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@whoami-pwd

This looks good but there isn't any details on how to setup with wp-env in your README. 🚀

@whoami-pwd whoami-pwd requested a review from colinmurphy April 15, 2025 15:05
@whoami-pwd
Copy link
Contributor Author

@whoami-pwd

This looks good but there isn't any details on how to setup with wp-env in your README. 🚀

@colinmurphy Sure, readme instructions added. Thank you!

colinmurphy
colinmurphy previously approved these changes Apr 15, 2025
Copy link
Member

@colinmurphy colinmurphy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@whoami-pwd

LGTM 🚀 🚀 🚀

moonmeister
moonmeister previously approved these changes Apr 18, 2025
Copy link
Member

@moonmeister moonmeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did a quick review of the JS. didn't do any actual testing but in general looks good. I left some quick notes on things I'd do different. That said none are deal breakers.

const fetch = require('node-fetch'); // make sure node-fetch is installed

async function fetchWpGlobalStyles(endpoint, outputPath = 'styles/hwp-global-styles.css', types = ['variables', 'presets', 'styles', 'base-layout-styles']) {
const typeEnums = types.map(type => type.toUpperCase().replace(/-/g, '_'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this really need RegEx or can it just do standard string replaces?

Copy link
Member

@ahuseyn ahuseyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice script and example @whoami-pwd 🚀🚀

  1. Build failed for me, so I've suggested the fixes related to it.
  2. Suggested changes to the readme.
  3. Added a script to run the style fetching and included it to the wp-env setup flow.

josephfusco
josephfusco previously approved these changes Apr 18, 2025
Copy link
Member

@josephfusco josephfusco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@whoami-pwd This looks good, I can help migrate this to from commonJS to ESM before merging in.

Comment on lines +4 to +5
"https://github.com/wp-graphql/wp-graphql/releases/latest/download/wp-graphql.zip",
"https://github.com/wp-graphql/wpgraphql-ide/releases/latest/download/wpgraphql-ide.zip",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the latest versions is good; we might want to consider pinning to a specific version of each plugin to mitigate examples breaking on future updates.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@josephfusco That's a good point.

I created this task here as we also need to consider a few other things - #148

@ahuseyn ahuseyn dismissed stale reviews from josephfusco, moonmeister, and colinmurphy via c07baf2 April 23, 2025 13:09
Copy link
Member

@colinmurphy colinmurphy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@whoami-pwd @ahuseyn

Looks good to me 🚀 🚀 🚀

One small thing (not a blocker) is once the PR is merged, lets create a follow on PR to add the example into the example README.

Comment on lines +4 to +5
"https://github.com/wp-graphql/wp-graphql/releases/latest/download/wp-graphql.zip",
"https://github.com/wp-graphql/wpgraphql-ide/releases/latest/download/wpgraphql-ide.zip",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@josephfusco That's a good point.

I created this task here as we also need to consider a few other things - #148

@colinmurphy
Copy link
Member

Also tested locally and looks great ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants