-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
Absolute url for encore_entry_link_tags and encore_entry_script_tags #19
Comments
+1 for this. I'm generating PDF documents, and the CSS is broken due to the asset URLs being relative instead of absolute. |
yes, I also need absolute url for generating PDFs |
Read the last part of README.md file:
Of course, it would be better if |
need for generating PDFs. |
Hmm, yes, I think this feature makes sense. Probably I would recommend 2 new functions:
I believe we would just need to use the |
I'm also in favor of that. My use case is the same as @benr77, i'm generating PDF files from HTML files and the pdf generator (https://github.com/GoogleChrome/puppeteer) needs absolute urls to proprely load the stylesheets. I was about to create an issue on the At the moment, i'm working around this by using a custom macro that relies on the {% macro encore_absolute_link_tags(entry_point) %}
{% for file in encore_entry_css_files(entry_point) %}
<link href="{{ absolute_url(asset(file)) }}" rel="stylesheet" />
{% endfor %}
{% endmacro %} (I see @weaverryan and I had the same idea regarding the naming) This only works for stylesheets (my only need so-far) but another macro with the same logic could be added to also support absolute urls for Havign this built-into the bundle would be really great ! |
this macro is not working to me, it doesn't return the files. Maybe the version I am using. Symfony4.2 trying to deploy on Apache. There is another way? |
same here. Did a trick for me. Hier is addition for scripts:
|
+1 |
2 similar comments
+1 |
+1 |
+1 (first in 2020) :) |
What about configuration of public path ? Assuming that your styles/scripts reside in
Tadaaa.. |
Hi, I found RenderAssetTagEvent, so you can make subscriber.
|
Sorry, this doesn't belong here. I had two windows open about the same issue and commented in the wrong one. -- |
This has helped me reference the correct path. Instead of having: 'https://your-domain.as-absolute-path.to/build/index.php/your-asset.css' it is now outputted as: 'https://your-domain.as-absolute-path.to/build/our-asset.css' |
as a workaround you can use the base html element : https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base |
+1 - Needed in PDF generation as well. |
Hello,
I think it would be interesting if I could pass to encore_entry_link_tags and encore_entry_script_tags functions that I want to generate tags with absolute url. Now, if I want to get absolute url, I can't use encore_entry_link_tags and encore_entry_script_tags.
The text was updated successfully, but these errors were encountered: