WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.36k stars 4.13k forks source link

Site editor theme export: Include local media in theme assets #41798

Open carolinan opened 2 years ago

carolinan commented 2 years ago

What problem does this address?

When creating a block theme using the Site Editor, chances are that you want to add media like images and video. If you choose media from the local media library, these files are not included when you export the theme. The path to the media still points to the media library.

Some blocks allow using remote media, but remote media is not always an option. -For example, if you want to share your theme in the WordPress.org theme directory, remote files are not allowed. -We also can not use s.w.org as some sort of public image CDN for our themes (this is where some images for the pattern directory are hosted).

This leaves a manual step to include media in the theme and update the paths. I believe we need to solve this so that we can use the export as part of no-code theme creation.

What is your proposed solution?

Find a way to identify the media, save it in the theme folder, and update the paths.

LukaszJaro commented 2 years ago

I exported patterns/reusable blocks from local to dev/stg and paths ended up being broken to the media, they were still pointing to my local install. I didn't notice this until someone else viewed it on their device and noticed images were not loading.

skorasaurus commented 2 years ago

reference about not being about to provide local paths to media: https://github.com/WordPress/gutenberg/issues/20966