-
Notifications
You must be signed in to change notification settings - Fork 8
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
WordPress Playground Integration Planning #14
Comments
I'm glad to see this issue! Here's some notes:
A PHP script coming from a plugin developer would do the trick – Playground can execute PHP code after all.
One approach would be to allow developers to upload a bundle of starter content/data. @artemiomorales is exploring import/export support to make this possible.
I'm not familiar with the details of the Starter Content feature, but just noting that some non-block themes can already set up the starter content: https://wasm.wordpress.net/wordpress.html?theme=pendant
Developers should have to declare the dependencies somewhere. Perhaps this could be solved on the ecosystem level by introducing |
Big picture-wise, I imagine a "Live Preview management" UI where the developers could:
Thinking a step further, there could be a generic "WordPress Playground package" format (like a .phar archive) that would encompass all of the above and would benefit from local development tools. |
Just noting:
This would be ideal, although my notes:
So thinking about this... That would be:
Bigger picture, It does make me question if this is actually a Theme Preview problem though ultimately; perhaps theme previews are just a subset of Playground Demo's, WordPress sites that we have in a directory as a starting point for new WordPress sites. They would include Blueprints, and full exports with DB/etc (which again, like above we'd probably want to inject the latest versions at download time, cached per day). |
@dd32 So the overall goal here is snappy theme preview loading, right? Would the step you listed happen server-side with a cronjob? Or in the browser? For the former, Playground CLI + some custom scripting could help. For the latter, a However, I wonder if that wouldn't actually slow down the boot once Offline Mode support lands. That's because after the initial load, your browser will source PHP and WordPress.zip from cache, so serving a new
Yes, I think that's a more general Playground apps problem. I hope the offline mode will greatly speed it up. |
Yes, to reduce the speed of loading as much as possible. I wasn't aware of Offline mode, but I don't think it impacts too much.
Probably it would be that the theme author would upload a ZIP, sourced from a playground instance Export option.
That's what I was thinking; except, the path allow/deny probably wouldn't be needed, my thought was we'd take the export.zip provided, remove anything from the ZIP that's not expected (the theme, plugins, etc) and have the client download the sanitised-export.zip + theme.zip + plugin1.zip + plugin2.zip.. I guess ideally we'd have those all bundled up, but probably not viable at first.
100% We'd want the bundle to exclude the PHP/WordPress zip, and only have anything unique to the theme preview.
I'm not sure it will greatly, since the WordPress+PHP+Wasm+etc zips are already cached client-side. The main speed issue I've seen is just waiting for them to download on a cold-boot (Offline doesn't help that) and that it appears that WordPress is installed from scratch every boot (I didn't think that would be a speed issue,and I'm not certain it is, other than that after the ZIPs download there's a second or two while it's "setting up WordPress") |
This isn't necessarily related to offline and could be considered an issue today. We download WordPress here and it looks like the only thing that disables the download is if WordPress is available in OPFS. If we want to avoid downloading WordPress twice, we could use the These ZIPs wouldn't be cached because they don't come from the Playground.WordPress.net, but that could be improved in the future.
That would resolve the issue. |
Playground now supports offline mode. PHP and WP are downloaded just once, additional bundles like plugins and themes are a subject to HTTP caching. This doesn't help with a cold load, but it helps with subsequent loads. From here, there's a few ways to reduce the initial download size. One is what you outlined @dd32, it seems like there are no technical blockers for this. Another would be pre-rendering the theme as a static site using Playground CLI and shipping that. There's also a hybrid approach where we'd still load Playground and the theme, but all the images and CSS files would be fetched from the remote server instead of being shipped with the initial |
What's the difference between previewing a theme and previewing a plugin? We could just add a "Open in WordPress Playground" button if a blueprint is available. That would set expectations that you will wait for something more. And just keep the existing preview button for now. Then if we get blueprints loading quicker, just use the Preview button. |
The primary difference is that Themes almost 100% require additional content be installed, which may include images, which is significantly slower to provision than plugins. If we were adding plugin previews with playground today, I'm not 100% that blueprints would be the right option either, it may be that any theme preview functionalities are ported back over to plugins too. |
@dd32 What would you say is the largest blocker for this today, assuming the extra content like images may be referenced from an external URL without frontloading them in Playground? |
## Motivation for the change, related issues The GitHub board automation workflow is failing due to a permissions error when attempting to create a label for the wporg-theme-directory repo. https://github.com/WordPress/wordpress-playground/actions/runs/10459089537/job/28962281299#step:3:7002 ``` ["message"]=> string(71) "adamziel does not have the correct permissions to execute `CreateLabel`" } } } Error processing card: WordPress/wporg-theme-directory#14 (WordPress Playground Integration Planning) GraphQL query failed Skipping that one and continuing... ``` ## Implementation details This change simply skips label updates for the wporg-theme-directory repo for which we do not have permission to create new labels. ## Testing Instructions (or ideally a Blueprint) - Test by manually running the board automation workflow from this PR's branch and make sure the workflow succeeds. - Try changing another issue's board status, rerun the workflow, and observe that the status is reflected in changed issue labels. - Restore the original issue status, rerun the workflow, and observe the original label has been restored.
@adamziel I'm not sure. I suspect the biggest blocker that I'm aware of is an easy way to boot up a WordPress instance with a defined DB rather than the builtin. I'm sure there's a way to do it, but I'm not aware off the top of my head of how to using vanilla playground. (ie. Last I looked, there wasn't a clear way to boot a Playground instance to resume a saved state / export, you boot, then import zip and overwrite the initialised environment) |
@dd32 there's a few ways to approach this:
Is this what you've had in mind? I know @annezazu and @juanmaguitar also explored restoring the Playground site from a ZIP export. |
I wasn't aware of the It looks like under the hood this just maps to the |
Yes! I use this option a fair amount. Most recently: https://nomad.blog/2024/08/29/join-me-in-testing-block-bindings-api/ Makes it super easy to offer ways for folks to help test. |
Yay! If I understand correctly, this is unblocked now 🎉 |
This issue is meant for planning purposes of possible integration with WordPress Playground
Considerations:
The text was updated successfully, but these errors were encountered: