-
-
Notifications
You must be signed in to change notification settings - Fork 200
Preserve subdirectories for assets in webpack output #223
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
Comments
Hi @flow38, Indeed, subdirectories are not kept by the default naming strategy. We discussed about it in #103 to solve another issue but decided not to keep them since it could generate some ugly paths sometimes. Usually that's not an issue because if you require your images from a file that's processed by Webpack, it'll directly give you the right path (e.g The good news is: you can change that quite easily using Encore.configureFilenames({
images: 'images/[path][name].[hash:8].[ext]',
}); |
Closing this issue, feel free to reopen it if you need more explanations @flow38. |
Hi @Lyrkan, love your answer, is there a way to manipulate that path? Because it's generating the whole path for the image and putting it in the images folder: It would be great if somehow I could achieve the next path: |
@antonstsk You'd have to set the There is no helper method in Encore to configure that loader but you can use Note that this will be applied to all image files, so if you import some from somewhere else it could lead to strange/long paths too. |
@Lyrkan understand that. The thing is that I have solid structure where the images are always in same places. Thank you for your time! |
Hello,
Currently encore do not seem to handle subdirectories path for generated assets:
My project structure is:
/assets
/assets/images/
/assets/images/logo
My template use this kind of code
img src="{{ asset('build/images/image1.jpg') }}"
img src="{{ asset('build/images/logos/image2.jpg') }}"
image2.jpg loading will fail cause manifest will look like
"build/images/image1.jpg": "/build/images/image1.6f30c87b.jpg",
"build/images/image2.jpg": "/build/images/image2.6f30c87b.jpg",
I could use in my template 'build/images/image2.jpg' path bu it's totally conter intuitive and error prone.
I did not test on other kind of assets, but subdirectories path should alway take into account by encore.
I found similar issue here but don't know how to apply it to encore and as explain, solution should be apply to all kind of assets.
Thanks for you help
Florent
The text was updated successfully, but these errors were encountered: