Skip to content

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

Closed
wants to merge 3 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 60 additions & 1 deletion reference/configuration/framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,66 @@ version_strategy
**type**: ``string`` **default**: ``null``

The service id of the :doc:`asset version strategy </frontend/custom_version_strategy>`
applied to the assets.
applied to the assets. This option can be set globally for all assets and
individually for each asset package:

.. configuration-block::

.. code-block:: yaml

# app/config/config.yml
framework:
assets:
# this strategy is applied to every asset (including packages)
version_strategy: 'app.asset.my_versioning_strategy'
packages:
foo_package:
# this makes the assets of this package to not be versioned
version: ~
bar_package:
# this package doesn't use the global versioning strategy
version_strategy: 'app.asset.another_version_strategy'
Copy link
Member

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 ?

Copy link
Member Author

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!


.. code-block:: xml

<!-- app/config/config.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">

<framework:config>
<framework:assets version_strategy="app.asset.my_versioning_strategy">
<framework:package
name="foo_package"
version="null" />
<framework:package
name="bar_package"
version-strategy="app.asset.another_version_strategy" />
</framework:assets>
</framework:config>
</container>

.. code-block:: php

// app/config/config.php
$container->loadFromExtension('framework', array(
'assets' => array(
'version_strategy' => 'app.asset.my_versioning_strategy',
'packages' => array(
'foo_package' => array(
// ...
'version' => null,
),
'bar_package' => array(
// ...
'version_strategy' => 'app.asset.another_version_strategy',
),
),
),
));

.. note::

Expand Down