-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Improved the explanation of "version_strategy" option #7519
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
Conversation
packages: | ||
foo_package: | ||
# ... except if a package explicitly uses the empty strategy | ||
version_strategy: 'assets.empty_version_strategy' |
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.
if you want to use the empty version strategy, a better solution is to configure the version
as empty rather than overwriting the strategy IMO. It avoids relying on the service id used in FrameworkBundle (se my comment in the symfony issue)
# app/config/config.yml | ||
framework: | ||
assets: | ||
# this strategy is applied to every asset (including packages) ... |
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.
this strategy is applied to all assets of the default package, and to all custom packages, unless they configure their own version or their own version strategy
The service id of the asset version strategy applied to the assets. In addition | ||
to your own :doc:`custom asset version strategies </frontend/custom_version_strategy>`, | ||
Symfony defines two services for its :ref:`built-in strategies <component-assets-versioning>`: | ||
``assets.empty_version_strategy`` and ``assets.static_version_strategy``. |
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.
assets.static_version_strategy
is not usable directly. It is an abstract service. So you cannot use it directly in version_strategy
. If you want to use a static version, use the version
setting (with a non-empty value) instead (which will create a child service configured with this version)
@stof thanks for your review! I've changed everything and I think it's better now. |
version: ~ | ||
bar_package: | ||
# this package doesn't use the global versioning strategy | ||
version_strategy: 'app.asset.another_version_strategy' |
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 would add a third part not redefining the version or strategy (but changing the base URL for instance), with a comment explaining that it inherits the default strategy, to make it easier to understand. What do you think about it ?
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 agree. I've done that in 7b09de0. Thanks!
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.
👍
Thank you Javier. |
…viereguiluz) This PR was submitted for the 3.1 branch but it was merged into the 3.2 branch instead (closes #7519). Discussion ---------- Improved the explanation of "version_strategy" option The idea to improve this came from symfony/symfony#21683 Commits ------- 9405e65 Improved the explanation of "version_strategy" option
* 3.2: (71 commits) Rewriting the service container docs Minor reword Adding a tip for validation in forms without class [#7217] add versionadded directives [#7203] merge note and versionadded directive Use the new configurator YAML syntax Added a note about the .htaccess files included by Symfony apps Made unmapped field example in forms chapter more descriptive [#7507] fix namespace [#7507] fix component name [#7490] minor typo fix Added a note about redirections to absolute URLs in tests [#7204] link to API doc Added docs for JsonResponse::fromJsonString Added the changes suggested by reviewers [#7620] use generate() in PHP templates before 2.8 Fixed the RST syntax Improve example context Minor formatting changes [#7519] some minor tweaks ...
The idea to improve this came from symfony/symfony#21683