Skip to content

Commit

Permalink
Added caution notes about the removal of AsseticBundle in 2.8/3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz authored and xabbuh committed Dec 14, 2015
1 parent 7d0a00a commit 433dd04
Show file tree
Hide file tree
Showing 11 changed files with 137 additions and 7 deletions.
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
85 changes: 85 additions & 0 deletions cookbook/assetic/asset_management.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,91 @@
How to Use Assetic for Asset Management
=======================================

Installing and Enabling Assetic
-------------------------------

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 in the ``AppKernel`` file of your Symfony application::

// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
// ...

public function registerBundles()
{
$bundles = array(
// ...
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
);

// ...
}
}

Finally, add the following minimal configuration to enable Assetic support in
your application:

.. 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,
),
// ...
));
// ...
Introducing Assetic
-------------------

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

0 comments on commit 433dd04

Please sign in to comment.