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

Appearance settings

Added "How to Use a Custom Version Strategy for Assets" #7141

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
merged 12 commits into from
Dec 12, 2016
Prev Previous commit
Next Next commit
Misc fixes
  • Loading branch information
javiereguiluz committed Dec 9, 2016
commit 981e82d6df14ec79ade24d18e8e44e4ccf5894e4
10 changes: 4 additions & 6 deletions 10 frontend/custom_version_strategy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ How to Use a Custom Version Strategy for Assets
Asset versioning is a technique that improves the performance of web
applications by adding a version identifier to the URL of the static assets
(CSS, JavaScript, images, etc.) When the content of the asset changes, its
identifier is also modified to force the browser download it again instead of
identifier is also modified to force the browser to download it again instead of
reusing the cached asset.

Symfony supports asset versioning thanks to the
Expand Down Expand Up @@ -103,16 +103,14 @@ version string::

private function loadManifest(array $options)
{
$hashes = json_decode(file_get_contents($this->manifestPath), true);

return $hashes;
return json_decode(file_get_contents($this->manifestPath), true);
}
}

Register the Strategy Service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

After creating the strategy PHP class, register it as a Symfony service
After creating the strategy PHP class, register it as a Symfony service.

.. configuration-block::

Expand Down Expand Up @@ -186,7 +184,7 @@ the :ref:`version_strategy <reference-framework-assets-version_strategy>` option
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">

<framework:config>
<framework:assets version_strategy="app.assets.versioning.gulp_buster" />
<framework:assets version-strategy="app.assets.versioning.gulp_buster" />
</framework:config>
</container>

Expand Down
2 changes: 1 addition & 1 deletion 2 reference/configuration/framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ version_strategy

**type**: ``string`` **default**: null

The service id of the :doc:`asset version strategy </frontend/custom_version:strategy>`
The service id of the :doc:`asset version strategy </frontend/custom_version_strategy>`
applied to the assets.

templating
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.