Skip to content

Added caution notes about the removal of AsseticBundle in 2.8/3.0 #5973

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 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 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
6 changes: 6 additions & 0 deletions best_practices/web-assets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ much more concise:
Using Assetic
-------------

.. caution::

Starting from Symfony 2.8, Assetic is no longer included by default in the
Symfony Standard Edition. Refer to :doc:`this article </cookbook/assetic/asset_management>`
to learn how to install and enable Assetic in your Symfony application.

These days, you probably can't simply create static CSS and JavaScript files
and include them in your template. Instead, you'll probably want to combine
and minify these to improve client-side performance. You may also want to
Expand Down
6 changes: 3 additions & 3 deletions book/templating.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1130,9 +1130,9 @@ advantage of Symfony's template inheritance.
.. tip::

This section will teach you the philosophy behind including stylesheet
and JavaScript assets in Symfony. Symfony also packages another library,
called Assetic, which follows this philosophy but allows you to do much
more interesting things with those assets. For more information on
and JavaScript assets in Symfony. Symfony is also compatible with another
library, called Assetic, which follows this philosophy but allows you to do
much more interesting things with those assets. For more information on
using Assetic see :doc:`/cookbook/assetic/asset_management`.

Start by adding two blocks to your base template that will hold your assets:
Expand Down
6 changes: 6 additions & 0 deletions cookbook/assetic/apply_to_option.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
How to Apply an Assetic Filter to a specific File Extension
===========================================================

.. caution::

Starting from Symfony 2.8, Assetic is no longer included by default in the
Symfony Standard Edition. Refer to :doc:`this article </cookbook/assetic/asset_management>`
to learn how to install and enable Assetic in your Symfony application.

Assetic filters can be applied to individual files, groups of files or even,
as you'll see here, files that have a specific extension. To show you how
to handle each option, suppose that you want to use Assetic's CoffeeScript
Expand Down
61 changes: 61 additions & 0 deletions cookbook/assetic/asset_management.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,67 @@
How to Use Assetic for Asset Management
=======================================

.. caution::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should make this normal text instead of inside a caution box


Starting from Symfony 2.8, Assetic is no longer included by default in the
Symfony Standard Edition. Before using any of its features, install the
AsseticBundle executing this console command in your project:

.. code-block:: bash

$ composer require symfony/assetic-bundle

Then, enable the bundle by adding the following configuration under the
``asetic`` key:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing information about registering the bundle in the AppKernel


.. configuration-block::

.. code-block:: yaml

# app/config/config.yml
assetic:
debug: "%kernel.debug%"
use_controller: false
filters:
cssrewrite: ~

# ...

.. 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"
xmlns:twig="http://symfony.com/schema/dic/twig"
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">

<assetic:config debug="%kernel.debug%" use-controller="%kernel.debug%">
<assetic:filters cssrewrite="null" />
</assetic:config>

<!-- ... -->
</container>

.. code-block:: php

// app/config/config.php

$container->loadFromExtension('assetic', array(
'debug' => '%kernel.debug%',
'use_controller' => '%kernel.debug%',
'filters' => array(
'cssrewrite' => null,
),
// ...
));

// ...

Assetic combines two major ideas: :ref:`assets <cookbook-assetic-assets>` and
:ref:`filters <cookbook-assetic-filters>`. The assets are files such as CSS,
JavaScript and image files. The filters are things that can be applied to
Expand Down
6 changes: 6 additions & 0 deletions cookbook/assetic/index.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Assetic
=======

.. caution::

Starting from Symfony 2.8, Assetic is no longer included by default in the
Symfony Standard Edition. Refer to :doc:`this article </cookbook/assetic/asset_management>`
to learn how to install and enable Assetic in your Symfony application.

.. toctree::
:maxdepth: 2

Expand Down
6 changes: 6 additions & 0 deletions cookbook/assetic/jpeg_optimize.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
How to Use Assetic for Image Optimization with Twig Functions
=============================================================

.. caution::

Starting from Symfony 2.8, Assetic is no longer included by default in the
Symfony Standard Edition. Refer to :doc:`this article </cookbook/assetic/asset_management>`
to learn how to install and enable Assetic in your Symfony application.

Among its many filters, Assetic has four filters which can be used for on-the-fly
image optimization. This allows you to get the benefits of smaller file sizes
without having to use an image editor to process each image. The results
Expand Down
6 changes: 6 additions & 0 deletions cookbook/assetic/php.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
Combining, Compiling and Minimizing Web Assets with PHP Libraries
=================================================================

.. caution::

Starting from Symfony 2.8, Assetic is no longer included by default in the
Symfony Standard Edition. Refer to :doc:`this article </cookbook/assetic/asset_management>`
to learn how to install and enable Assetic in your Symfony application.

The official Symfony Best Practices recommend to use Assetic to
:doc:`manage web assets </best_practices/web-assets>`, unless you are
comfortable with JavaScript-based front-end tools.
Expand Down
6 changes: 6 additions & 0 deletions cookbook/assetic/uglifyjs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
How to Minify CSS/JS Files (Using UglifyJS and UglifyCSS)
=========================================================

.. caution::

Starting from Symfony 2.8, Assetic is no longer included by default in the
Symfony Standard Edition. Refer to :doc:`this article </cookbook/assetic/asset_management>`
to learn how to install and enable Assetic in your Symfony application.

`UglifyJS`_ is a JavaScript parser/compressor/beautifier toolkit. It can be used
to combine and minify JavaScript assets so that they require less HTTP requests
and make your site load faster. `UglifyCSS`_ is a CSS compressor/beautifier
Expand Down
6 changes: 6 additions & 0 deletions cookbook/assetic/yuicompressor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ How to Minify JavaScripts and Stylesheets with YUI Compressor
**strongly advised to avoid using YUI utilities** unless strictly necessary.
Read :doc:`/cookbook/assetic/uglifyjs` for a modern and up-to-date alternative.

.. caution::

Starting from Symfony 2.8, Assetic is no longer included by default in the
Symfony Standard Edition. Refer to :doc:`this article </cookbook/assetic/asset_management>`
to learn how to install and enable Assetic in your Symfony application.

Yahoo! provides an excellent utility for minifying JavaScripts and stylesheets
so they travel over the wire faster, the `YUI Compressor`_. Thanks to Assetic,
you can take advantage of this tool very easily.
Expand Down
6 changes: 6 additions & 0 deletions reference/configuration/assetic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
AsseticBundle Configuration ("assetic")
=======================================

.. caution::

Starting from Symfony 2.8, Assetic is no longer included by default in the
Symfony Standard Edition. Refer to :doc:`this article </cookbook/assetic/asset_management>`
to learn how to install and enable Assetic in your Symfony application.

Full Default Configuration
--------------------------

Expand Down
5 changes: 1 addition & 4 deletions reference/twig_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -739,10 +739,7 @@ Those bundles can have other Twig extensions:

* **Twig Extensions** includes some interesting extensions that do not belong
to the Twig core. You can read more in `the official Twig Extensions
documentation`_;
* **Assetic** adds the ``{% stylesheets %}``, ``{% javascripts %}`` and
``{% image %}`` tags. You can read more about them in
:doc:`the Assetic Documentation </cookbook/assetic/asset_management>`.
documentation`_.

.. _`Twig Reference`: http://twig.sensiolabs.org/documentation#reference
.. _`the official Twig Extensions documentation`: http://twig.sensiolabs.org/doc/extensions/index.html