Skip to content

Commit 433dd04

Browse files
javiereguiluzxabbuh
authored andcommitted
Added caution notes about the removal of AsseticBundle in 2.8/3.0
1 parent 7d0a00a commit 433dd04

File tree

11 files changed

+137
-7
lines changed

11 files changed

+137
-7
lines changed

Diff for: best_practices/web-assets.rst

+6
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ much more concise:
3535
Using Assetic
3636
-------------
3737

38+
.. caution::
39+
40+
Starting from Symfony 2.8, Assetic is no longer included by default in the
41+
Symfony Standard Edition. Refer to :doc:`this article </cookbook/assetic/asset_management>`
42+
to learn how to install and enable Assetic in your Symfony application.
43+
3844
These days, you probably can't simply create static CSS and JavaScript files
3945
and include them in your template. Instead, you'll probably want to combine
4046
and minify these to improve client-side performance. You may also want to

Diff for: book/templating.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -1130,9 +1130,9 @@ advantage of Symfony's template inheritance.
11301130
.. tip::
11311131

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

11381138
Start by adding two blocks to your base template that will hold your assets:

Diff for: cookbook/assetic/apply_to_option.rst

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
How to Apply an Assetic Filter to a specific File Extension
55
===========================================================
66

7+
.. caution::
8+
9+
Starting from Symfony 2.8, Assetic is no longer included by default in the
10+
Symfony Standard Edition. Refer to :doc:`this article </cookbook/assetic/asset_management>`
11+
to learn how to install and enable Assetic in your Symfony application.
12+
713
Assetic filters can be applied to individual files, groups of files or even,
814
as you'll see here, files that have a specific extension. To show you how
915
to handle each option, suppose that you want to use Assetic's CoffeeScript

Diff for: cookbook/assetic/asset_management.rst

+85
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,91 @@
44
How to Use Assetic for Asset Management
55
=======================================
66

7+
Installing and Enabling Assetic
8+
-------------------------------
9+
10+
Starting from Symfony 2.8, Assetic is no longer included by default in the
11+
Symfony Standard Edition. Before using any of its features, install the
12+
AsseticBundle executing this console command in your project:
13+
14+
.. code-block:: bash
15+
16+
$ composer require symfony/assetic-bundle
17+
18+
Then, enable the bundle in the ``AppKernel`` file of your Symfony application::
19+
20+
// app/AppKernel.php
21+
22+
// ...
23+
class AppKernel extends Kernel
24+
{
25+
// ...
26+
27+
public function registerBundles()
28+
{
29+
$bundles = array(
30+
// ...
31+
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
32+
);
33+
34+
// ...
35+
}
36+
}
37+
38+
Finally, add the following minimal configuration to enable Assetic support in
39+
your application:
40+
41+
.. configuration-block::
42+
43+
.. code-block:: yaml
44+
45+
# app/config/config.yml
46+
assetic:
47+
debug: "%kernel.debug%"
48+
use_controller: false
49+
filters:
50+
cssrewrite: ~
51+
52+
# ...
53+
54+
.. code-block:: xml
55+
56+
<!-- app/config/config.xml -->
57+
<?xml version="1.0" encoding="UTF-8" ?>
58+
<container xmlns="http://symfony.com/schema/dic/services"
59+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
60+
xmlns:framework="http://symfony.com/schema/dic/symfony"
61+
xmlns:twig="http://symfony.com/schema/dic/twig"
62+
xsi:schemaLocation="http://symfony.com/schema/dic/services
63+
http://symfony.com/schema/dic/services/services-1.0.xsd
64+
http://symfony.com/schema/dic/symfony
65+
http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
66+
67+
<assetic:config debug="%kernel.debug%" use-controller="%kernel.debug%">
68+
<assetic:filters cssrewrite="null" />
69+
</assetic:config>
70+
71+
<!-- ... -->
72+
</container>
73+
74+
.. code-block:: php
75+
76+
// app/config/config.php
77+
78+
$container->loadFromExtension('assetic', array(
79+
'debug' => '%kernel.debug%',
80+
'use_controller' => '%kernel.debug%',
81+
'filters' => array(
82+
'cssrewrite' => null,
83+
),
84+
// ...
85+
));
86+
87+
// ...
88+
89+
Introducing Assetic
90+
-------------------
91+
792
Assetic combines two major ideas: :ref:`assets <cookbook-assetic-assets>` and
893
:ref:`filters <cookbook-assetic-filters>`. The assets are files such as CSS,
994
JavaScript and image files. The filters are things that can be applied to

Diff for: cookbook/assetic/index.rst

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Assetic
22
=======
33

4+
.. caution::
5+
6+
Starting from Symfony 2.8, Assetic is no longer included by default in the
7+
Symfony Standard Edition. Refer to :doc:`this article </cookbook/assetic/asset_management>`
8+
to learn how to install and enable Assetic in your Symfony application.
9+
410
.. toctree::
511
:maxdepth: 2
612

Diff for: cookbook/assetic/jpeg_optimize.rst

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
How to Use Assetic for Image Optimization with Twig Functions
55
=============================================================
66

7+
.. caution::
8+
9+
Starting from Symfony 2.8, Assetic is no longer included by default in the
10+
Symfony Standard Edition. Refer to :doc:`this article </cookbook/assetic/asset_management>`
11+
to learn how to install and enable Assetic in your Symfony application.
12+
713
Among its many filters, Assetic has four filters which can be used for on-the-fly
814
image optimization. This allows you to get the benefits of smaller file sizes
915
without having to use an image editor to process each image. The results

Diff for: cookbook/assetic/php.rst

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
Combining, Compiling and Minimizing Web Assets with PHP Libraries
55
=================================================================
66

7+
.. caution::
8+
9+
Starting from Symfony 2.8, Assetic is no longer included by default in the
10+
Symfony Standard Edition. Refer to :doc:`this article </cookbook/assetic/asset_management>`
11+
to learn how to install and enable Assetic in your Symfony application.
12+
713
The official Symfony Best Practices recommend to use Assetic to
814
:doc:`manage web assets </best_practices/web-assets>`, unless you are
915
comfortable with JavaScript-based front-end tools.

Diff for: cookbook/assetic/uglifyjs.rst

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
How to Minify CSS/JS Files (Using UglifyJS and UglifyCSS)
55
=========================================================
66

7+
.. caution::
8+
9+
Starting from Symfony 2.8, Assetic is no longer included by default in the
10+
Symfony Standard Edition. Refer to :doc:`this article </cookbook/assetic/asset_management>`
11+
to learn how to install and enable Assetic in your Symfony application.
12+
713
`UglifyJS`_ is a JavaScript parser/compressor/beautifier toolkit. It can be used
814
to combine and minify JavaScript assets so that they require less HTTP requests
915
and make your site load faster. `UglifyCSS`_ is a CSS compressor/beautifier

Diff for: cookbook/assetic/yuicompressor.rst

+6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ How to Minify JavaScripts and Stylesheets with YUI Compressor
1010
**strongly advised to avoid using YUI utilities** unless strictly necessary.
1111
Read :doc:`/cookbook/assetic/uglifyjs` for a modern and up-to-date alternative.
1212

13+
.. caution::
14+
15+
Starting from Symfony 2.8, Assetic is no longer included by default in the
16+
Symfony Standard Edition. Refer to :doc:`this article </cookbook/assetic/asset_management>`
17+
to learn how to install and enable Assetic in your Symfony application.
18+
1319
Yahoo! provides an excellent utility for minifying JavaScripts and stylesheets
1420
so they travel over the wire faster, the `YUI Compressor`_. Thanks to Assetic,
1521
you can take advantage of this tool very easily.

Diff for: reference/configuration/assetic.rst

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
AsseticBundle Configuration ("assetic")
55
=======================================
66

7+
.. caution::
8+
9+
Starting from Symfony 2.8, Assetic is no longer included by default in the
10+
Symfony Standard Edition. Refer to :doc:`this article </cookbook/assetic/asset_management>`
11+
to learn how to install and enable Assetic in your Symfony application.
12+
713
Full Default Configuration
814
--------------------------
915

Diff for: reference/twig_reference.rst

+1-4
Original file line numberDiff line numberDiff line change
@@ -739,10 +739,7 @@ Those bundles can have other Twig extensions:
739739

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

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

0 commit comments

Comments
 (0)