Skip to content
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

Use AppBundle whenever it's possible #4740

Merged
merged 1 commit into from
Jan 16, 2015
Merged
Show file tree
Hide file tree
Changes from all 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
24 changes: 12 additions & 12 deletions cookbook/assetic/apply_to_option.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ templates:

.. code-block:: html+jinja

{% javascripts '@AcmeFooBundle/Resources/public/js/example.coffee' filter='coffee' %}
{% javascripts '@AppBundle/Resources/public/js/example.coffee' filter='coffee' %}
<script src="{{ asset_url }}" type="text/javascript"></script>
{% endjavascripts %}

.. code-block:: html+php

<?php foreach ($view['assetic']->javascripts(
array('@AcmeFooBundle/Resources/public/js/example.coffee'),
array('@AppBundle/Resources/public/js/example.coffee'),
array('coffee')
) as $url): ?>
<script src="<?php echo $view->escape($url) ?>" type="text/javascript"></script>
Expand All @@ -84,8 +84,8 @@ You can also combine multiple CoffeeScript files into a single output file:

.. code-block:: html+jinja

{% javascripts '@AcmeFooBundle/Resources/public/js/example.coffee'
'@AcmeFooBundle/Resources/public/js/another.coffee'
{% javascripts '@AppBundle/Resources/public/js/example.coffee'
'@AppBundle/Resources/public/js/another.coffee'
filter='coffee' %}
<script src="{{ asset_url }}" type="text/javascript"></script>
{% endjavascripts %}
Expand All @@ -94,8 +94,8 @@ You can also combine multiple CoffeeScript files into a single output file:

<?php foreach ($view['assetic']->javascripts(
array(
'@AcmeFooBundle/Resources/public/js/example.coffee',
'@AcmeFooBundle/Resources/public/js/another.coffee',
'@AppBundle/Resources/public/js/example.coffee',
'@AppBundle/Resources/public/js/another.coffee',
),
array('coffee')
) as $url): ?>
Expand Down Expand Up @@ -170,19 +170,19 @@ being run through the CoffeeScript filter):

.. code-block:: html+jinja

{% javascripts '@AcmeFooBundle/Resources/public/js/example.coffee'
'@AcmeFooBundle/Resources/public/js/another.coffee'
'@AcmeFooBundle/Resources/public/js/regular.js' %}
{% javascripts '@AppBundle/Resources/public/js/example.coffee'
'@AppBundle/Resources/public/js/another.coffee'
'@AppBundle/Resources/public/js/regular.js' %}
<script src="{{ asset_url }}" type="text/javascript"></script>
{% endjavascripts %}

.. code-block:: html+php

<?php foreach ($view['assetic']->javascripts(
array(
'@AcmeFooBundle/Resources/public/js/example.coffee',
'@AcmeFooBundle/Resources/public/js/another.coffee',
'@AcmeFooBundle/Resources/public/js/regular.js',
'@AppBundle/Resources/public/js/example.coffee',
'@AppBundle/Resources/public/js/another.coffee',
'@AppBundle/Resources/public/js/regular.js',
)
) as $url): ?>
<script src="<?php echo $view->escape($url) ?>" type="text/javascript"></script>
Expand Down
66 changes: 33 additions & 33 deletions cookbook/assetic/asset_management.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ To include JavaScript files, use the ``javascripts`` tag in any template:

.. code-block:: html+jinja

{% javascripts '@AcmeFooBundle/Resources/public/js/*' %}
{% javascripts '@AppBundle/Resources/public/js/*' %}
<script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}

.. code-block:: html+php

<?php foreach ($view['assetic']->javascripts(
array('@AcmeFooBundle/Resources/public/js/*')
array('@AppBundle/Resources/public/js/*')
) as $url): ?>
<script type="text/javascript" src="<?php echo $view->escape($url) ?>"></script>
<?php endforeach ?>
Expand All @@ -81,7 +81,7 @@ To include JavaScript files, use the ``javascripts`` tag in any template:

{# ... #}
{% block javascripts %}
{% javascripts '@AcmeFooBundle/Resources/public/js/*' %}
{% javascripts '@AppBundle/Resources/public/js/*' %}
<script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
{% endblock %}
Expand All @@ -92,7 +92,7 @@ To include JavaScript files, use the ``javascripts`` tag in any template:
You can also include CSS Stylesheets: see :ref:`cookbook-assetic-including-css`.

In this example, all of the files in the ``Resources/public/js/`` directory
of the ``AcmeFooBundle`` will be loaded and served from a different location.
of the ``AppBundle`` will be loaded and served from a different location.
The actual rendered tag might simply look like:

.. code-block:: html
Expand All @@ -115,14 +115,14 @@ above, except with the ``stylesheets`` tag:

.. code-block:: html+jinja

{% stylesheets 'bundles/acme_foo/css/*' filter='cssrewrite' %}
{% stylesheets 'bundles/app/css/*' filter='cssrewrite' %}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}

.. code-block:: html+php

<?php foreach ($view['assetic']->stylesheets(
array('bundles/acme_foo/css/*'),
array('bundles/app/css/*'),
array('cssrewrite')
) as $url): ?>
<link rel="stylesheet" href="<?php echo $view->escape($url) ?>" />
Expand All @@ -138,7 +138,7 @@ above, except with the ``stylesheets`` tag:

{# ... #}
{% block stylesheets %}
{% stylesheets 'bundles/acme_foo/css/*' filter='cssrewrite' %}
{% stylesheets 'bundles/app/css/*' filter='cssrewrite' %}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
{% endblock %}
Expand All @@ -151,11 +151,11 @@ the :ref:`cssrewrite <cookbook-assetic-cssrewrite>` filter.
.. note::

Notice that in the original example that included JavaScript files, you
referred to the files using a path like ``@AcmeFooBundle/Resources/public/file.js``,
referred to the files using a path like ``@AppBundle/Resources/public/file.js``,
but that in this example, you referred to the CSS files using their actual,
publicly-accessible path: ``bundles/acme_foo/css``. You can use either, except
publicly-accessible path: ``bundles/app/css``. You can use either, except
that there is a known issue that causes the ``cssrewrite`` filter to fail
when using the ``@AcmeFooBundle`` syntax for CSS Stylesheets.
when using the ``@AppBundle`` syntax for CSS Stylesheets.

.. _cookbook-assetic-including-image:

Expand All @@ -168,14 +168,14 @@ To include an image you can use the ``image`` tag.

.. code-block:: html+jinja

{% image '@AcmeFooBundle/Resources/public/images/example.jpg' %}
{% image '@AppBundle/Resources/public/images/example.jpg' %}
<img src="{{ asset_url }}" alt="Example" />
{% endimage %}

.. code-block:: html+php

<?php foreach ($view['assetic']->image(
array('@AcmeFooBundle/Resources/public/images/example.jpg')
array('@AppBundle/Resources/public/images/example.jpg')
) as $url): ?>
<img src="<?php echo $view->escape($url) ?>" alt="Example" />
<?php endforeach ?>
Expand All @@ -198,7 +198,7 @@ You can see an example in the previous section.
.. caution::

When using the ``cssrewrite`` filter, don't refer to your CSS files using
the ``@AcmeFooBundle`` syntax. See the note in the above section for details.
the ``@AppBundle`` syntax. See the note in the above section for details.

Combining Assets
~~~~~~~~~~~~~~~~
Expand All @@ -215,7 +215,7 @@ but still serve them as a single file:
.. code-block:: html+jinja

{% javascripts
'@AcmeFooBundle/Resources/public/js/*'
'@AppBundle/Resources/public/js/*'
'@AcmeBarBundle/Resources/public/js/form.js'
'@AcmeBarBundle/Resources/public/js/calendar.js' %}
<script src="{{ asset_url }}"></script>
Expand All @@ -225,7 +225,7 @@ but still serve them as a single file:

<?php foreach ($view['assetic']->javascripts(
array(
'@AcmeFooBundle/Resources/public/js/*',
'@AppBundle/Resources/public/js/*',
'@AcmeBarBundle/Resources/public/js/form.js',
'@AcmeBarBundle/Resources/public/js/calendar.js',
)
Expand Down Expand Up @@ -254,17 +254,17 @@ combine third party assets, such as jQuery, with your own into a single file:
.. code-block:: html+jinja

{% javascripts
'@AcmeFooBundle/Resources/public/js/thirdparty/jquery.js'
'@AcmeFooBundle/Resources/public/js/*' %}
'@AppBundle/Resources/public/js/thirdparty/jquery.js'
'@AppBundle/Resources/public/js/*' %}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}

.. code-block:: html+php

<?php foreach ($view['assetic']->javascripts(
array(
'@AcmeFooBundle/Resources/public/js/thirdparty/jquery.js',
'@AcmeFooBundle/Resources/public/js/*',
'@AppBundle/Resources/public/js/thirdparty/jquery.js',
'@AppBundle/Resources/public/js/*',
)
) as $url): ?>
<script src="<?php echo $view->escape($url) ?>"></script>
Expand All @@ -287,8 +287,8 @@ configuration under the ``assetic`` section. Read more in the
assets:
jquery_and_ui:
inputs:
- '@AcmeFooBundle/Resources/public/js/thirdparty/jquery.js'
- '@AcmeFooBundle/Resources/public/js/thirdparty/jquery.ui.js'
- '@AppBundle/Resources/public/js/thirdparty/jquery.js'
- '@AppBundle/Resources/public/js/thirdparty/jquery.ui.js'

.. code-block:: xml

Expand All @@ -299,8 +299,8 @@ configuration under the ``assetic`` section. Read more in the

<assetic:config>
<assetic:asset name="jquery_and_ui">
<assetic:input>@AcmeFooBundle/Resources/public/js/thirdparty/jquery.js</assetic:input>
<assetic:input>@AcmeFooBundle/Resources/public/js/thirdparty/jquery.ui.js</assetic:input>
<assetic:input>@AppBundle/Resources/public/js/thirdparty/jquery.js</assetic:input>
<assetic:input>@AppBundle/Resources/public/js/thirdparty/jquery.ui.js</assetic:input>
</assetic:asset>
</assetic:config>
</container>
Expand All @@ -312,8 +312,8 @@ configuration under the ``assetic`` section. Read more in the
'assets' => array(
'jquery_and_ui' => array(
'inputs' => array(
'@AcmeFooBundle/Resources/public/js/thirdparty/jquery.js',
'@AcmeFooBundle/Resources/public/js/thirdparty/jquery.ui.js',
'@AppBundle/Resources/public/js/thirdparty/jquery.js',
'@AppBundle/Resources/public/js/thirdparty/jquery.ui.js',
),
),
),
Expand All @@ -328,7 +328,7 @@ with the ``@named_asset`` notation:

{% javascripts
'@jquery_and_ui'
'@AcmeFooBundle/Resources/public/js/*' %}
'@AppBundle/Resources/public/js/*' %}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}

Expand All @@ -337,7 +337,7 @@ with the ``@named_asset`` notation:
<?php foreach ($view['assetic']->javascripts(
array(
'@jquery_and_ui',
'@AcmeFooBundle/Resources/public/js/*',
'@AppBundle/Resources/public/js/*',
)
) as $url): ?>
<script src="<?php echo $view->escape($url) ?>"></script>
Expand Down Expand Up @@ -406,14 +406,14 @@ into your template:

.. code-block:: html+jinja

{% javascripts '@AcmeFooBundle/Resources/public/js/*' filter='uglifyjs2' %}
{% javascripts '@AppBundle/Resources/public/js/*' filter='uglifyjs2' %}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}

.. code-block:: html+php

<?php foreach ($view['assetic']->javascripts(
array('@AcmeFooBundle/Resources/public/js/*'),
array('@AppBundle/Resources/public/js/*'),
array('uglifyjs2')
) as $url): ?>
<script src="<?php echo $view->escape($url) ?>"></script>
Expand All @@ -432,14 +432,14 @@ done from the template and is relative to the public document root:

.. code-block:: html+jinja

{% javascripts '@AcmeFooBundle/Resources/public/js/*' output='js/compiled/main.js' %}
{% javascripts '@AppBundle/Resources/public/js/*' output='js/compiled/main.js' %}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}

.. code-block:: html+php

<?php foreach ($view['assetic']->javascripts(
array('@AcmeFooBundle/Resources/public/js/*'),
array('@AppBundle/Resources/public/js/*'),
array(),
array('output' => 'js/compiled/main.js')
) as $url): ?>
Expand Down Expand Up @@ -555,14 +555,14 @@ some isolated directory (e.g. ``/js/compiled``), to keep things organized:

.. code-block:: html+jinja

{% javascripts '@AcmeFooBundle/Resources/public/js/*' output='js/compiled/main.js' %}
{% javascripts '@AppBundle/Resources/public/js/*' output='js/compiled/main.js' %}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}

.. code-block:: html+php

<?php foreach ($view['assetic']->javascripts(
array('@AcmeFooBundle/Resources/public/js/*'),
array('@AppBundle/Resources/public/js/*'),
array(),
array('output' => 'js/compiled/main.js')
) as $url): ?>
Expand Down
6 changes: 3 additions & 3 deletions cookbook/assetic/jpeg_optimize.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ It can now be used from a template:

.. code-block:: html+jinja

{% image '@AcmeFooBundle/Resources/public/images/example.jpg'
{% image '@AppBundle/Resources/public/images/example.jpg'
filter='jpegoptim' output='/images/example.jpg' %}
<img src="{{ asset_url }}" alt="Example"/>
{% endimage %}

.. code-block:: html+php

<?php foreach ($view['assetic']->image(
array('@AcmeFooBundle/Resources/public/images/example.jpg'),
array('@AppBundle/Resources/public/images/example.jpg'),
array('jpegoptim')
) as $url): ?>
<img src="<?php echo $view->escape($url) ?>" alt="Example"/>
Expand Down Expand Up @@ -204,7 +204,7 @@ The Twig template can now be changed to the following:

.. code-block:: html+jinja

<img src="{{ jpegoptim('@AcmeFooBundle/Resources/public/images/example.jpg') }}" alt="Example"/>
<img src="{{ jpegoptim('@AppBundle/Resources/public/images/example.jpg') }}" alt="Example"/>

You can specify the output directory in the config in the following way:

Expand Down
14 changes: 7 additions & 7 deletions cookbook/assetic/uglifyjs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -161,22 +161,22 @@ your assets are a part of the view layer, this work is done in your templates:

.. code-block:: html+jinja

{% javascripts '@AcmeFooBundle/Resources/public/js/*' filter='uglifyjs2' %}
{% javascripts '@AppBundle/Resources/public/js/*' filter='uglifyjs2' %}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}

.. code-block:: html+php

<?php foreach ($view['assetic']->javascripts(
array('@AcmeFooBundle/Resources/public/js/*'),
array('@AppBundle/Resources/public/js/*'),
array('uglifyj2s')
) as $url): ?>
<script src="<?php echo $view->escape($url) ?>"></script>
<?php endforeach ?>

.. note::

The above example assumes that you have a bundle called ``AcmeFooBundle``
The above example assumes that you have a bundle called ``AppBundle``
and your JavaScript files are in the ``Resources/public/js`` directory under
your bundle. This isn't important however - you can include your JavaScript
files no matter where they are.
Expand All @@ -197,14 +197,14 @@ apply this filter when debug mode is off (e.g. ``app.php``):

.. code-block:: html+jinja

{% javascripts '@AcmeFooBundle/Resources/public/js/*' filter='?uglifyjs2' %}
{% javascripts '@AppBundle/Resources/public/js/*' filter='?uglifyjs2' %}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}

.. code-block:: html+php

<?php foreach ($view['assetic']->javascripts(
array('@AcmeFooBundle/Resources/public/js/*'),
array('@AppBundle/Resources/public/js/*'),
array('?uglifyjs2')
) as $url): ?>
<script src="<?php echo $view->escape($url) ?>"></script>
Expand Down Expand Up @@ -272,14 +272,14 @@ helper:

.. code-block:: html+jinja

{% stylesheets 'bundles/AcmeFoo/css/*' filter='uglifycss' filter='cssrewrite' %}
{% stylesheets 'bundles/App/css/*' filter='uglifycss' filter='cssrewrite' %}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}

.. code-block:: html+php

<?php foreach ($view['assetic']->stylesheets(
array('bundles/AcmeFoo/css/*'),
array('bundles/App/css/*'),
array('uglifycss'),
array('cssrewrite')
) as $url): ?>
Expand Down
Loading