-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Framework] Add tag assets.package to register asset packages #38473
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thank you for this PR. I like it, it is a rare feature but I think we should support it. |
(rebase needed) |
cc2d512
to
0472fd7
Compare
Thank you for the reminder. The branch has been rebased. |
nicolas-grekas
approved these changes
Feb 11, 2021
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.
LGTM, thanks (with minor comments)
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/UnusedTagsPass.php
Show resolved
Hide resolved
Autoconfiguration with PackageInterface
0472fd7
to
6217ff7
Compare
nicolas-grekas
approved these changes
Feb 12, 2021
xabbuh
approved these changes
Feb 15, 2021
fabpot
approved these changes
Feb 16, 2021
Thank you @GromNaN. |
javiereguiluz
added a commit
to symfony/symfony-docs
that referenced
this pull request
Feb 19, 2021
This PR was squashed before being merged into the 5.3-dev branch. Discussion ---------- [Framework] Add tag assets.package Documentation for symfony/symfony#38473 Commits ------- f4dbec4 [Framework] Add tag assets.package
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Replaces #38366
To configure asset packages in an application, we have to declare it in the
framework
configuration (doc for assets config). In some case we cannot use this configuration:This PR adds the
assets.package
tag. This tag is use to collect and inject package services into theassets.packages
service, that is the registry for all packages. Since every package needs a name, thepackage
attribute of the tag is used (same naming convention that theconsole.command
tag).Main changes:
framework.assets
configuration are injected into theassets.packages
using the tag instead of being directly injected in service declaration.Symfony\Components\Assets\Packages
constructor to accept an iterator (backward compatible).assets._default_package
is defined even if assets are not configured.Example in
symfony/demo
(commit):In
config/services.yaml
:Then we can use the package anywhere
Alternative using autoconfiguration with a custom class:
With a custom class implementing the
PackageInterface
, the package name can be provided by a the static methodgetDefaultPackageName
. Autowiring and autoconfiguration will import the package.