-
Notifications
You must be signed in to change notification settings - Fork 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
FSE: require asset files (not _once) #42414
Conversation
This PR does not affect the size of JS and CSS bundles shipped to the user's browser. Generated by performance advisor bot at iscalypsofastyet.com. |
I feel like there are more asset includes than the ones in the PR so far. I don't really understand why it needs to change, but I trust you and everyone else on that issue about it :) |
It's the $LHS = require_once 'RHS.php';
It's problematic with asset files becuase find these on the right hand side of assignments: $assets = require_once 'my-asset-file.php'; Becuase it's an assignment and not simply bringing something into scope (the typical way we want to use |
Makes a lot more sense now, thanks! It would be really nice (in the future) if we could abstract the asset stuff out of each of the sub-modules. The code is so similar across all of them, and yet each tend to do slightly different things which makes it hard to know exactly what to add when you are creating a new sub-module. |
require_once is unsafe for a require that should return a value on each function call. See WordPress/gutenberg#18599
1f436ce
to
3a75e27
Compare
Caution: This PR affects files in the FSE Plugin on WordPress.com D44003-code has been created so you can easily test it on your sandbox. See this FieldGuide page about developing in the FSE Plugin for more info: PCYsg-ly5-p2 |
I've rebased and the automated FSE builds are working again. This needs testing and review if anyone can spare a moment 🙇♂️ |
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.
Looking good to me, and the WP.com diff seems to test fine.
Let's wait for the mobile e2e tests to re-run.
Changes proposed in this Pull Request
require
should be used for asset files notrequire_once
. See WordPress/gutenberg#18599Illustration of the issue, note the second
require_once
returnstrue
.Compare to
require
:Testing instructions