-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Theme Export: Add index.php and style.css #39173
Conversation
Size Change: -30 B (0%) Total Size: 1.15 MB
ℹ️ View Unchanged
|
$zip->addFromString( | ||
'theme/style.css', | ||
file_get_contents( get_stylesheet_directory() . '/style.css' ) | ||
); |
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 think we can use ZipArchive::addFile
here. It is what core uses in privacy tools export.
@@ -62,6 +62,16 @@ function gutenberg_generate_block_templates_export_file() { | |||
wp_json_encode( $tree->get_data(), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) | |||
); | |||
|
|||
$zip->addFromString( | |||
'theme/index.php', | |||
'<?php // This file is needed to make the theme work, but it doesn\'t do anything.' |
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.
Can we go with "Silence is golden"?
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 wonder if the best thing to do is the same as for the style.css - just copy the index.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 am approving this as it is easy to update and revert but it gives us a ground to see how it works. After checking out the nit picks, 🚢
I changed the approach slightly to just copy the index.php and style.css from the current theme. |
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.
Thanks, @scruffian!
We also might want to use wp_normalize_path
for file paths.
Description
This adds an index.php and style.css to the export part of the Site Editor. Addressing part of #38199. This raises a few questions:
Testing Instructions
Types of changes
New feature (non-breaking change which adds functionality)
Checklist:
*.native.js
files for terms that need renaming or removal).