Skip to content
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

Add asset annotation to the HTML template engine ? #1

Open
DamienDabernat opened this issue Nov 18, 2022 · 0 comments
Open

Add asset annotation to the HTML template engine ? #1

DamienDabernat opened this issue Nov 18, 2022 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@DamienDabernat
Copy link
Owner

Like twig :

The asset() function's main purpose is to make the application more portable. If your application lives at the root of your host (e.g. https://example.com), then the rendered path should be /images/logo.png. But if your application lives in a subdirectory (e.g. https://example.com/my_app), each asset path should render with the subdirectory (e.g. /my_app/images/logo.png). The asset() function takes care of this by determining how your application is being used and generating the correct paths accordingly.

{# the image lives at "public/images/logo.png" #}
<img src="{{ asset('images/logo.png') }}" alt="Symfony!"/>

{# the CSS file lives at "public/css/blog.css" #}
<link href="{{ asset('css/blog.css') }}" rel="stylesheet"/>

{# the JS file lives at "public/bundles/acme/js/loader.js" #}
<script src="{{ asset('bundles/acme/js/loader.js') }}"></script>
@DamienDabernat DamienDabernat added the enhancement New feature or request label Nov 18, 2022
@DamienDabernat DamienDabernat added this to the v1 milestone Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant