8000 [AssetMapper] Allow simple, relative paths in importmap.php by weaverryan · Pull Request #51729 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[AssetMapper] Allow simple, relative paths in importmap.php #51729

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

Merged

Conversation

weaverryan
Copy link
Member
Q A
Branch? 6.4
Bug fix? no
New feature? yes
Deprecations? no
Tickets None
License MIT
Doc PR TODO

This PR is based on top of #51543 - so that needs to be merged first.

Currently, the path key in importmap.php MUST be the logic path to an file. Especially when trying to refer to assets in a bundle, this forces us to use paths that... don't look very obvious to users - e.g.

    'app' => [
        'path' => 'app.js',
    ],
    '@symfony/stimulus-bundle' => [
        'path' => '@symfony/stimulus-bundle/loader.js',
    ],

This PR adds support for relative paths (starting with .). This means the importmap.php file can look like this now:

    'app' => [
        'path' => './assets/app.js',
    ],
    '@symfony/stimulus-bundle' => [
        'path' => './vendor/symfony/stimulus-bundle/assets/dist/loader.js',
    ],

Those paths are now simple. One less thing to explain to people.

@carsonbot carsonbot added this to the 6.4 milestone Sep 24, 2023
@weaverryan weaverryan force-pushed the asset-mapper-importmap-allow-real-paths branch 3 times, most recently from a17396c to a1fd08b Compare September 29, 2023 17:23
@weaverryan
Copy link
Member Author

Should be good - just reviewed the code again & works locally on ux.symfony.com also with the relative paths.

@nicolas-grekas nicolas-grekas force-pushed the asset-mapper-importmap-allow-real-paths branch from a43b9f8 to 978b14d Compare September 29, 2023 18:11
@nicolas-grekas
Copy link
Member

Thank you @weaverryan.

@nicolas-grekas nicolas-grekas merged commit 0b78897 into symfony:6.4 Sep 29, 2023
@weaverryan weaverryan deleted the asset-mapper-importmap-allow-real-paths branch September 29, 2023 18:15
This was referenced Oct 21, 2023
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
0