From 560e010de144488f308a2b17f804ff833e8252bc Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Tue, 6 May 2014 07:56:24 -0500 Subject: [PATCH 1/2] Adding more details to be clear that you can set asset version globally or locally on an asset --- book/templating.rst | 29 ++++++++++--------- .../templating/helpers/assetshelper.rst | 3 +- reference/configuration/framework.rst | 4 +++ 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/book/templating.rst b/book/templating.rst index d2a3301a8b8..7c3c31aa7a8 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -991,40 +991,43 @@ assets won't be cached when deployed. For example, ``/images/logo.png`` might look like ``/images/logo.png?v2``. For more information, see the :ref:`ref-framework-assets-version` configuration option. +.. _` + .. versionadded:: 2.5 - Absolute URLs for assets were introduced in Symfony 2.5. + Setting versioned URLs on an asset-by-asset basis were introduced in Symfony 2.5. -If you need absolute URLs for assets, you can set the third argument (or the -``absolute`` argument) to ``true``: +If you need to set a version for a specific asset, you can set the fourth +argument (or the ``version`` argument) to the desired version: .. configuration-block:: .. code-block:: html+jinja - Symfony! + Symfony! .. code-block:: html+php - Symfony! + Symfony! + +If you dont give a version or pass ``null``, the default package version +(from :ref:`ref-framework-assets-version`) wil be used. If you pass ``false``, +versioned URL will be deactivated for this asset. .. versionadded:: 2.5 - Versioned URLs for assets were introduced in Symfony 2.5. + Absolute URLs for assets were introduced in Symfony 2.5. -If you need versioned URLs for assets, you can set the fourth argument (or the -``version`` argument) to the desired version: +If you need absolute URLs for assets, you can set the third argument (or the +``absolute`` argument) to ``true``: .. configuration-block:: .. code-block:: html+jinja - Symfony! + Symfony! .. code-block:: html+php - Symfony! - -If you dont give a version or pass ``null``, the default package version will -be used. If you pass ``false``, versioned URL will be deactivated. + Symfony! .. index:: single: Templating; Including stylesheets and JavaScripts diff --git a/components/templating/helpers/assetshelper.rst b/components/templating/helpers/assetshelper.rst index 6f096d35c52..8e8dbf857bc 100644 --- a/components/templating/helpers/assetshelper.rst +++ b/components/templating/helpers/assetshelper.rst @@ -83,7 +83,8 @@ second is the version. For instance, ``%s?v=%s`` will be rendered as .. versionadded:: 2.5 On-demand versioned URLs for assets were introduced in Symfony 2.5. -You can also generate a versioned URL using the fourth argument of the helper: +You can also generate a versioned URL on an asset-by-asset basis using the +fourth argument of the helper: .. code-block:: html+php diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 79c62088a62..a57f578887d 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -369,6 +369,10 @@ Now, the same asset will be rendered as ``/images/logo.png?v2`` If you use this feature, you **must** manually increment the ``assets_version`` value before each deployment so that the query parameters change. +It's also possible to set the version value on an asset-by-asset basis (instead +of using the global version - e.g. ``v2`` - set here). See +:ref:`Versioning by Asset ` for details. + You can also control how the query string works via the `assets_version_format`_ option. From 4eafdbde933b4dc850531ec94a373e440e7ee7bf Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sat, 10 May 2014 17:02:41 -0500 Subject: [PATCH 2/2] [#3837] Fixes thanks to stof and WouterJ --- book/templating.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/book/templating.rst b/book/templating.rst index 7c3c31aa7a8..545e1c24531 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -991,10 +991,10 @@ assets won't be cached when deployed. For example, ``/images/logo.png`` might look like ``/images/logo.png?v2``. For more information, see the :ref:`ref-framework-assets-version` configuration option. -.. _` +.. _`book-templating-version-by-asset`: .. versionadded:: 2.5 - Setting versioned URLs on an asset-by-asset basis were introduced in Symfony 2.5. + Setting versioned URLs on an asset-by-asset basis was introduced in Symfony 2.5. If you need to set a version for a specific asset, you can set the fourth argument (or the ``version`` argument) to the desired version: @@ -1003,14 +1003,14 @@ argument (or the ``version`` argument) to the desired version: .. code-block:: html+jinja - Symfony! + Symfony! .. code-block:: html+php Symfony! If you dont give a version or pass ``null``, the default package version -(from :ref:`ref-framework-assets-version`) wil be used. If you pass ``false``, +(from :ref:`ref-framework-assets-version`) will be used. If you pass ``false``, versioned URL will be deactivated for this asset. .. versionadded:: 2.5