-
Notifications
You must be signed in to change notification settings - Fork 41
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
wp-now load .zip downloaded from wordpress-playground #137
base: trunk
Are you sure you want to change the base?
Conversation
…e from a wp-content pull request
This now works with my wp-bundler wp-cli command. https://github.com/rhildred/wp-bundler. The idea is that I can add the wp-bundler plugin in wordpress playground and it will build on cloudflare pages or github pages with |
|
||
php.mount(`${projectPath}/wp-content`, `${documentRoot}/wp-content`); | ||
|
||
if (!fs.existsSync(`${projectPath}/wp-content/db.php`)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see why you put that in here. Normally mountSqlitePlugin()
takes care of that, but it also overrides the database file – and in your case the database file is already there. I'd love mountSqlitePlugin()
to respect any pre-existing databases so that runWpContentMode()
could work with both a "regular" WordPress and a Playground export. What do you think @sejas @danielbachhuber ?
This is a great use-case @rhildred, thank you for proposing this PR! It marks an important step in making Playground portable between the browser and a local dev environment ❤️ I left an inline note to see if we could make one of the existing modes support that use-case instead of creating a new mode. |
What?
Bring .zip from wordpress-playground into node.js with wp-now. I also exposed the existing wp-cli code on the command line with
@wp-now/wp-now wp --version
for further testing.Why?
I am leading a class in wordpress this term. There is a lab each week, for which students hand in a .zip of their site. Wordpress-playground offers the ability for students to produce the .zip that I am looking for. To mark the lab, I have code that makes a folder for each student. I want to be able to start a terminal in vscode in the student folder, type
npx @wp-now/wp-now start
and see the student's wordpress.I exposed the wp-cli interface in wp-now so that I can author a plugin that creates a static site from wordpress using ob_start. For instance:
How?
I added a mode that looks for a wp-content folder without a wp-include folder. From there it was fairly short work to get the mounts correct to use the folder.
Testing Instructions
npm run build
unzip ~/Downloads/wordpress-playground\ \(8\).zip
or somethingnode ../dist/packages/wp-now/main.js start
Thanks so much for this package and your advice on using it with my students. My plan is to use wp-playground and the .zip download for my student's first wordpress class on Monday night.