Patterns: proposal for "download pattern" in context-menu for selection of blocks. #44187
Labels
[Feature] Patterns
A collection of blocks that can be synced (previously reusable blocks) or unsynced
[Type] Enhancement
A suggestion for improvement.
What problem does this address?
Patterns use absolute src urls. Deploying a new FSE theme with patterns made on a localhost server requires a search-replace in the code to change the paths to the live domain. This is really inconvenient.
As most know, there is a challenge in reading relative URL's from a HTML template (see explorations here: #31815, and this #20966). But the patterns engine now runs on PHP. To my understanding, this is possible because we can now properly parse blocks from a php file.
This proposal looks for a solution to make pattern creation (1) easier, and (2) solve the 'absolute url' problem.
Creating a pattern is currently done by: "copy all code, paste it in a php file in
/patterns
, add a file header". How about we automate this step?What is your proposed solution?
When a selection of blocks is selected, a "download pattern" option should appear in the context menu.
Pressing this button should:
esc_url( get_theme_file_uri( 'assets/images/flora.png' )
)Why?
Subsequent pro's:
wp-pattern-{pattern-slug}
) could be added.The text was updated successfully, but these errors were encountered: