Is your feature request related to a problem? Please describe.
At present, I include SVGs built from Vite using both .asset() and .inline()
{% set logoPath = craft.vite.asset('src/images/logo.svg') %}
{{ logoPath|default ? craft.vite.inline(logoPath)|attr({"class": "w-12"}) }}
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.
{{ craft.vite.inline('src/images/logo.svg')|attr({"class": "w-12"}) }}
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.
{% set logoPath = craft.vite.asset('src/images/logo.svg', public=false, pathOnly=true) %}
{{ logoPath }} # outputs 'dist/assets/images/logo-bbdb01c5.svg', which can then be concatenated with '@webroot'
{{ craft.vite.inline("@webroot/#{logoPath}")|attr({"class": "w-12"}) }}
Is your feature request related to a problem? Please describe.
At present, I include SVGs built from Vite using both
.asset()and.inline(){% set logoPath = craft.vite.asset('src/images/logo.svg') %} {{ logoPath|default ? craft.vite.inline(logoPath)|attr({"class": "w-12"}) }}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.
{{ craft.vite.inline('src/images/logo.svg')|attr({"class": "w-12"}) }}This would need to reference the manifest to get the built file path, and likely use
@webrootto 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.{% set logoPath = craft.vite.asset('src/images/logo.svg', public=false, pathOnly=true) %} {{ logoPath }} # outputs 'dist/assets/images/logo-bbdb01c5.svg', which can then be concatenated with '@webroot' {{ craft.vite.inline("@webroot/#{logoPath}")|attr({"class": "w-12"}) }}