-
-
Notifications
You must be signed in to change notification settings - Fork 16
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 support for referencing src paths to craft.vite.inline() #72
Comments
I am running into similar issues and I think they might actually be the same: When inlining SVGs with |
PRs are welcome! |
Similar to: nystudio107/craft-plugin-vite#22 |
So two things here...
Currently, the Vite plugin has no awareness at all of web root file system paths except for the Also in general, if you're having Vite process assets (like SVGs), the expectation is that they will be loaded via JavaScript. If you have a bunch of SVG icons that you're not loading via JavaScript, probably the best thing to do is just put them into your Vite That way you know the fixed path that they will always be referenced from. You don't really gain anything by version hashing them or running them through Vite, unless I suppose you change them with some frequency, and thus want the version hash for cache busting purposes. |
Is your feature request related to a problem? Please describe.
At present, I include SVGs built from Vite using both
.asset()
and.inline()
This works, but is inlining the file from the full URL, whereas I would greatly prefer to use the local file path.
Describe the solution you would like
I would like to be able to pass the src path straight into the inline function.
This would need to reference the manifest to get the built file path, and likely use
@webroot
to access the file. It may require an additional config setting for the path to dist.Describe alternatives you have considered
Alternatively,
.asset()
could accept an additional parameter to return only the file path.The text was updated successfully, but these errors were encountered: