Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Asset] [DX] Option to make asset manifests strict on missing item#38495
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
src/Symfony/Component/Asset/VersionStrategy/RemoteJsonManifestVersionStrategy.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
weaverryan left a comment
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.
I like it! WebpackEncoreBundle has had this option for a long time - called strict_mode - for an entry that doesn’t appear in entrypoints.json
| ->args([ | ||
| abstract_arg('manifest url'), | ||
| service('http_client'), | ||
| false, |
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.
I think these should both be abstract args - as we fill both in always
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.
I used a fixed value to prevent breaking compatibility in the eventuality someone extends this abstract definition.
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.
Is it something I must change ?
src/Symfony/Component/Asset/VersionStrategy/JsonManifestVersionStrategy.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Asset/VersionStrategy/JsonManifestVersionStrategy.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Asset/VersionStrategy/JsonManifestVersionStrategy.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
7d60341 toabeb56cCompareUh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Asset/VersionStrategy/JsonManifestVersionStrategy.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Asset/VersionStrategy/RemoteJsonManifestVersionStrategy.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
This comment has been minimized.
This comment has been minimized.
ed7d12f toe76aea7CompareGromNaN commentedJan 30, 2021
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Asset/Tests/VersionStrategy/JsonManifestVersionStrategyTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
nicolas-grekas commentedFeb 16, 2021
(small rebase needed) |
GromNaN commentedFeb 17, 2021
Rebased. The CS fix suggested by fabbot are not related to this PR. |
GromNaN commentedApr 26, 2021
Rebased again. |
javiereguiluz left a comment
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.
Nice proposal! Jérôme, thanks for contributing this feature. I hope it's merged 👍
fabpot commentedJul 25, 2021
Thank you@GromNaN. |
…ategy (GromNaN)This PR was merged into the 5.4 branch.Discussion----------[Asset] Add option $strictMode to JsonManifestVersionStrategyDocumentation forsymfony/symfony#38495Commits-------c4e19eb [Assets] Add doc for strict mode strategy
Uh oh!
There was an error while loading.Please reload this page.
In all the projects I use a JSON manifest, when an asset is not listed in manifest.json, the asset file is not generated. The current behavior is permissive as it returns the unmodified path of the asset. Which ends with a 404 when the browser tries to load the asset.
With the option
strict_mode: true, an exception is thrown when we try to use an asset that is not listed inmanifest.json. Thereby we don't have to check that asset urls are actually working in tests (manual or automated).Usage:
The option
strict_modeis optional for backward compatibility. Using the%kernel.debug%value is safe to flush bugs on dev or test mode but keep the application working on production.Todo:
Update recipe ?