Skip to content

Navigation Menu

Sign in
Appearance settings
Sign up
Appearance settings

[FrameworkBundle] Move AssetMapper internal artefacts in build dir - #65642

#65642
Open
smnandre wants to merge 4 commits into
symfony:8.2symfony/symfony:8.2from
smnandre:asset-mapper-compile-cache-dirsmnandre/symfony:asset-mapper-compile-cache-dirCopy head branch name to clipboard
Open

[FrameworkBundle] Move AssetMapper internal artefacts in build dir#65642
smnandre wants to merge 4 commits into
symfony:8.2symfony/symfony:8.2from
smnandre:asset-mapper-compile-cache-dirsmnandre/symfony:asset-mapper-compile-cache-dirCopy head branch name to clipboard

Conversation

@smnandre

@smnandre smnandre commented Aug 25, 2026

Copy link
Copy Markdown
Member
Q A
Branch? 8.2
Bug fix? no
New feature? yes
Deprecations? yes
Issues -
License MIT

TL;DR;

AssetMapper let files publically readable (that list all assets of an app).
This fight any effort to create some "confidentiality" here
(cf all issues wanting to have admin/www assets split and free for scrutiny)

This PR moves assetmapper artefacts in build dir, but maintain per default current behaviour (with a deprecation)

Current situation

asset-map:compile currently writes two different kinds of files to the public assets
directory:

  • digested assets that the web server must serve (in /public/assets per default)
  • manifest.json, importmap.json and entrypoint.*.json, which are read by PHP only.

This makes internal compile metadata publicly accessible and gives it the same deployment
lifecycle as browser assets, even though the two have different consumers.

Changes

This PR adds the framework.asset_mapper.metadata_dir option. It controls only where
AssetMapper writes and reads its compiled metadata. Digested JavaScript, CSS, images and other
public assets continue to be written to the configured public assets directory.

The 8.2 default remains unchanged for backward compatibility: when the option is not set, the
metadata stays in the public assets directory. Not setting the option is deprecated when the
application actually maps assets, and the default will change to
%kernel.build_dir%/asset_mapper in 9.0.

Applications can adopt the future default immediately:

framework:
    asset_mapper:
        metadata_dir: '%kernel.build_dir%/asset_mapper'

Or they can keep the current location explicitly:

framework:
    asset_mapper:
        metadata_dir: '%kernel.project_dir%/public/assets'

Deployments that adopt the build directory must deploy it together with the public assets.

The deprecation is emitted only when AssetMapper has at least one configured application or
bundle asset path. Empty configurations do not compile metadata and therefore have no location
to choose.

--

Update: renamed compile_cache_dir in metadata_dir

@GromNaN GromNaN left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wouldn't that cause problems, such as with relative paths or front-end frameworks that use these files?

Comment thread src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php Outdated
@smnandre

Copy link
Copy Markdown
Member Author

Wouldn't that cause problems, such as with relative paths or front-end frameworks that use these files?

This is why I introduce a public setting. Rare or specific cases will still be possible :)

@smnandre
smnandre force-pushed the asset-mapper-compile-cache-dir branch from 966d200 to 4a5a497 Compare August 26, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

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