Skip to content

Move SVG handling to media assets block for Symfony's Asset Mapper compatibility #530

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ricardomm85
Copy link

👉 Describe the problem

The current Nginx configuration separates SVG files from other media assets. This creates an inconsistency with how Symfony's Asset Mapper component handles assets, particularly in development environments where SVG files should be served through PHP just like other media assets.

👥 Problem evidence & reach

This affects all developers using Symfony's Asset Mapper with this Nginx configuration. The inconsistent handling causes problems in development environments where Asset Mapper needs to serve versioned SVG files through PHP, but the Nginx configuration doesn't forward these requests correctly.

🏆 How to solve this problem

Move the SVG file handling from the "svg, fonts" location block to the "assets, media" location block to align with Asset Mapper's handling of assets in both development and production environments.

🥰 Describe the "impact" on users?

This change will provide seamless integration with Symfony's Asset Mapper component. In development, SVG files will be properly served through the PHP application, allowing for dynamic versioning. In production (after running asset-map:compile), they'll be served directly by Nginx with appropriate caching headers. Developers will have a more consistent experience across environments and won't encounter issues specific to SVG files.

💯 How do we validate the problem is solved?

  • In development: Versioned SVG files (like /assets/images/logo-3c16d92m.svg) should be correctly handled by the PHP application
  • In production: After running asset-map:compile, SVG files should be served directly from the filesystem with proper caching
  • Confirm there are no 404 errors for SVG assets in either environment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant