Skip to content

[Asset] Missing manifest file throws an exception #11462

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
Closed
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
62 changes: 62 additions & 0 deletions reference/configuration/framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1534,6 +1534,68 @@ package:
If you request an asset that is *not found* in the ``manifest.json`` file, the original -
*unmodified* - asset path will be returned.


json_manifest_allow_missing
...........................

**type**: ``boolean`` **default**: ``false``

If set the true and the manifest file is *not found*, no error will be thrown.

This option can only be set globally:

.. configuration-block::

.. code-block:: yaml

# config/packages/framework.yaml
framework:
assets:
# this manifest is applied to every asset (including packages)
json_manifest_allow_missing: true
bar_package:
Copy link
Member

Choose a reason for hiding this comment

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

missing packages node

# this package uses the global manifest (the default file is used)
base_path: '/images'

.. code-block:: xml

<!-- config/packages/framework.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"
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">

<framework:config>
<!-- if the manifest is missing nothing will be return -->
<framework:assets json-manifest-allow-missing="trye">
<framework:package
name="bar_package"
base-path="/images"/>
</framework:assets>
</framework:config>
</container>

.. code-block:: php

// config/packages/framework.php
$container->loadFromExtension('framework', [
'assets' => [
// if the manifest is missing nothing will be return
'json_manifest_allow_missing' => 'true',
'packages' => [
'bar_package' => [
// this package uses the global manifest (the default file is used)
'base_path' => '/images',
],
],
],
]);

.. versionadded:: 4.3


templating
~~~~~~~~~~

Expand Down