-
Notifications
You must be signed in to change notification settings - Fork 4
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
Do not fatal if manifest is missing (type hinting) #41
Comments
I think the biggest issue is that it's inconsistent with the behaviour of What do you think about some kind of strict mode flag/argument which lets a user decide whether it fatally errors? |
Not particularly font of strict modes, it's another layer you need to keep in mind on top of environment, WP_Debug, etc. 🤔 My rough stance here is that there's many things that can cause a build to fail, and I wouldn't want the site to fatal if a plugin was activated without a build process in place or in a situation where assets didn't get omitted as expected. On the sort of sites we work on, as an example, if we were adding a blocks plugin I'd consider it much more desirable to have the site load sans those blocks than to fail to load entirely. |
OK so maybe an explicit argument in the functions? function enqueue_asset( string $manifest_path, string $target_asset, array $options = [], bool $strict_require = false ); For something like GDPR cookie code for example, it might be desired behaviour to break rather than miss the script. |
Fixed in #59 |
(extracted from a comment on #40)
Probably the biggest risk / gotcha I run into regularly with Asset Loader right now is that if you try to enqueue a file and there is no manifest on disk,
get_asset_manifest()
returnsnull
which is not a string which causes a 500.This is a rough edge we should probably smooth off, by one or more of
(enqueue|register)_asset
if the manifest is missingI'm personally most in favor of removing the constraint and possibly adding an error, but curious for thoughts. @Sephsekla et al
The text was updated successfully, but these errors were encountered: