New in Symfony 5.1: Remote asset manifest
Warning: This post is about an unsupported Symfony version. Some of this information may be out of date. Read the most recent Symfony Docs.
Contributed by
Jérôme Tamarelle
in #35762.
Webpack Encore is a pure-JavaScript library developed by Symfony as a simpler
way to integrate Webpack into your application. When building assets, Webpack
Encore creates a manifest.json
file listing all the generated assets (and
their versioning).
In Symfony 5.1, we've improved this feature to allow using manifest files stored in other servers and retrieved via HTTP requests. This is useful when using CDNs (content delivery networks) to serve your assets.
You don't need to add or enable any option to use this new feature. Just update
the value of your existing json_manifest_path
option and use an absolute
URL. Symfony will make an HTTP request automatically to retrieve the manifest:
1 2 3 4
# config/packages/assets.yaml
framework:
assets:
json_manifest_path: 'https://cdn.example.com/manifest.json'
Help the Symfony project!
As with any Open-Source project, contributing code or documentation is the most common way to help, but we also have a wide range of sponsoring opportunities.
Comments
Comments are closed.
To ensure that comments stay relevant, they are closed for old posts.