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:

# config/packages/assets.yaml
        json_manifest_path: ''
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.


Typo: to server -> to serve
Fixed! Thanks Massimiliano!
GG @gromnan
This feature has been inspired by how we use manifests to deploy assets shared across every PrismaMedia's websites.

Comments are closed.

To ensure that comments stay relevant, they are closed for old posts.