-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Scripts: Copy PHP files from src
into build
#38715
Scripts: Copy PHP files from src
into build
#38715
Conversation
src
into build
src
into build
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.
Looks great. I added a changelog entry since people will suddenly start seeing PHP files in the build folder which might be surprising for them.
Thanks, @gziolo! I ALWAYS forget to add the changelog. |
ブロックをロードするパスをsrcからbuildに変更 関連 #1034 WordPress/gutenberg#38715
Hi, is there a way to disable this? I guess I need to override the webpack config? |
Yes, you would need to override the default config. Something like: https://github.com/WordPress/gutenberg/tree/trunk/packages/scripts#extending-the-webpack-config Can you explain the issue you have? It looks like the change introduced needs some tweaks so we are seeking more detailed feedback to provide better defaults. |
Sure, I'm happy to do so. We're using
So basically, our use-case is using |
We're using a similar directory structure in AMP WP plugin, i.e. the Right now the default source directory name of |
After introducing WordPress/gutenberg#38715, PHP files from the `src` folder are copied over to the output directory (i.e. `assets`). To prevent this, the `CopyWebpackPlugin` is excluded from the plugins list. It is safe since the only other file type the plugin copies is `block.json` that is not used in `amp-wp`.
Follow up PR to move to an opt-in approach - #39171 |
Landed, I will publish shortly to npm to remove friction as discussed. |
Description
When building dynamic blocks, there are many cases where splitting out the markup into an external PHP file is very helpful. The current build process copies the block.json file into the
build
directory but any.php
files are not. This PR adds them to the copying process.Testing Instructions
I created a block using
npx @wordpress/create-block@ my-first-dynamic-block --template=@ryanwelcher/dynamic-block-template
( this contains an template.php file in the src directory )Then ran
node {FULLPATH}/gutenberg/packages/scripts/bin/wp-scripts.js -- build
Screenshots
Types of changes
Adds any .PHP files inside of
src
to it's corresponding location inbuild
Checklist:
*.native.js
files for terms that need renaming or removal).