File tree 2 files changed +17
-0
lines changed
2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -165,6 +165,19 @@ In those cases, use the
165
165
echo $package->getUrl('css/app.css');
166
166
// result: build/css/app.b916426ea1d10021f3f17ce8031f93c2.css
167
167
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
+
168
181
Custom Version Strategies
169
182
.........................
170
183
Original file line number Diff line number Diff line change @@ -1970,6 +1970,10 @@ package:
1970
1970
If you request an asset that is *not found * in the ``manifest.json `` file, the original -
1971
1971
*unmodified * - asset path will be returned.
1972
1972
1973
+ .. note ::
1974
+
1975
+ If an URL is set, the JSON manifest is downloaded on each request using the `http_client `_.
1976
+
1973
1977
translator
1974
1978
~~~~~~~~~~
1975
1979
You can’t perform that action at this time.
0 commit comments