Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 45152ee

Browse filesBrowse files
committed
[Asset] Remote JSON manifest
1 parent a184324 commit 45152ee
Copy full SHA for 45152ee

File tree

2 files changed

+17
-0
lines changed
Filter options

2 files changed

+17
-0
lines changed

‎components/asset.rst

Copy file name to clipboardExpand all lines: components/asset.rst
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,19 @@ In those cases, use the
165165
echo $package->getUrl('css/app.css');
166166
// result: build/css/app.b916426ea1d10021f3f17ce8031f93c2.css
167167

168+
If the JSON file not on the filesystem, but it is accessible using HTTP, use the
169+
:class:`Symfony\\Component\\Asset\\VersionStrategy\\RemoteJsonManifestVersionStrategy`
170+
with the :doc:`HttpClient component </components/http_client>`::
171+
172+
use Symfony\Component\Asset\Package;
173+
use Symfony\Component\Asset\VersionStrategy\RemoteJsonManifestVersionStrategy;
174+
use Symfony\Component\HttpClient\HttpClient;
175+
176+
$httpClient = HttpClient::create();
177+
$manifestUrl = 'https://cdn.example.com/rev-manifest.json';
178+
$package = new Package(new RemoteJsonManifestVersionStrategy($manifestUrl, $httpClient));
179+
180+
168181
Custom Version Strategies
169182
.........................
170183

‎reference/configuration/framework.rst

Copy file name to clipboardExpand all lines: reference/configuration/framework.rst
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1970,6 +1970,10 @@ package:
19701970
If you request an asset that is *not found* in the ``manifest.json`` file, the original -
19711971
*unmodified* - asset path will be returned.
19721972

1973+
.. note::
1974+
1975+
If an URL is set, the JSON manifest is downloaded on each request using the `http_client`_.
1976+
19731977
translator
19741978
~~~~~~~~~~
19751979

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.