Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Merged
fabpot merged 1 commit intosymfony:5.4fromGromNaN:assets-strict
Jul 25, 2021

Conversation

@GromNaN
Copy link
Member

@GromNaNGromNaN commentedOct 9, 2020
edited
Loading

QA
Branch?5.4
Bug fix?no
New feature?yes
Deprecations?no
Tickets-
LicenseMIT
Doc PRsymfony/symfony-docs#14414

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 optionstrict_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 optionstrict_mode is 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.

# config/packages/assets.yamlframework:assets:packages:app:# Uses a JSON manifest (can be a local path or an url remote file)json_manifest_path:'%kernel.project_dir%/public/build/manifest.json'# Throws an exception when an expected entry is missing in the manifeststrict_mode:'%kernel.debug%'

Todo:

jvasseur, madflow, maxhelias, and yoriiis reacted with thumbs up emoji
@nicolas-grekasnicolas-grekas added this to the5.x milestoneOct 12, 2020
@GromNaNGromNaN marked this pull request as ready for reviewOctober 14, 2020 20:39
@GromNaNGromNaN requested a review fromstofOctober 14, 2020 20:39
@GromNaNGromNaN changed the title[Asset] Option to make asset manifests strict on missing item[DX][Asset] Option to make asset manifests strict on missing itemOct 15, 2020
Copy link
Member

@weaverryanweaverryan left a 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

GromNaN reacted with hooray emoji
->args([
abstract_arg('manifest url'),
service('http_client'),
false,
Copy link
Member

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

Copy link
MemberAuthor

@GromNaNGromNaNOct 15, 2020
edited
Loading

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.

Copy link
MemberAuthor

@GromNaNGromNaNMay 27, 2021
edited
Loading

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 ?

@GromNaNGromNaNforce-pushed theassets-strict branch 2 times, most recently from7d60341 toabeb56cCompareOctober 16, 2020 07:46
@GromNaN

This comment has been minimized.

@GromNaNGromNaNforce-pushed theassets-strict branch 2 times, most recently fromed7d12f toe76aea7CompareJanuary 30, 2021 22:38
@GromNaN
Copy link
MemberAuthor

Thanks to the refactoring done by@jderusse in#39484, this PR has been simplified.

@carsonbotcarsonbot changed the title[DX][Asset] Option to make asset manifests strict on missing item[Asset] [DX] Option to make asset manifests strict on missing itemFeb 16, 2021
@nicolas-grekas
Copy link
Member

(small rebase needed)

GromNaN reacted with thumbs up emoji

@GromNaN
Copy link
MemberAuthor

Rebased. The CS fix suggested by fabbot are not related to this PR.

@GromNaN
Copy link
MemberAuthor

Rebased again.

Copy link
Member

@javiereguiluzjaviereguiluz left a 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 👍

GromNaN reacted with heart emoji
@fabpot
Copy link
Member

Thank you@GromNaN.

@fabpotfabpot merged commit7e28580 intosymfony:5.4Jul 25, 2021
@GromNaNGromNaN deleted the assets-strict branchOctober 14, 2021 19:04
This was referencedNov 5, 2021
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull requestDec 13, 2021
…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
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@javiereguiluzjaviereguiluzjaviereguiluz approved these changes

@stofstofAwaiting requested review from stof

@weaverryanweaverryanAwaiting requested review from weaverryan

@OskarStarkOskarStarkAwaiting requested review from OskarStark

+1 more reviewer

@maxheliasmaxheliasmaxhelias approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

5.4

Development

Successfully merging this pull request may close these issues.

9 participants

@GromNaN@nicolas-grekas@fabpot@javiereguiluz@weaverryan@stof@OskarStark@maxhelias@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp