Closed aitormendez closed 5 years ago
Are you sure it's installing v2.0.0? The default path was changed to resources/svg
is why I ask.
Sorry about the delayed response.
The reason your path isn't working is due to how Sage's default webpack config hashes the filename. During compilation, flecha-aba-peq.svg
would become flecha-aba-peq_[hash].svg
which is ultimately why I moved away from using the dist
directory as it's not necessary to hash (especially in the way Sage does it out of the box) something you're programmatically inlining in your markup.
When I get some time, I will look into implementing a config variable that you can set to true
to make Blade SVG use the manifest (asset_path()
) for retrieving the SVG– but I can't give an ETA or even a promise that it will happen due to how blade-svg handles pathing internally:
SvgFactory()->svg($name)
(e.g. @svg('name')
) from SvgFactory.php#L68.Svg()->renderInline()
from Svg.php#L54 which then goes back to SvgFactory to call SvgFactory()->getSvg($name)
of which finally combines the path and icon.This ends up making it difficult to alter the icon/path and wrap it in asset_path()
to make us able to return the value from the manifest.json.
But if I'm being honest, this all comes down to Sage's build system being way over the top in handling cache busting. It should instead do what Laravel Mix and every other build system does, and append an argument to the end of the filename inside of the manifest on each build such as icon.svg?id=[hash]
so pulling an asset from the manifest isn't forcefully required.
So ultimately, your options as of right now are:
resources/
like my default config.Understood. Thank you for your time and your excelent work.
I'm getting the
File does not exist at path
error whenyarn build:production
.This is the warning:
File does not exist at path /srv/www/margenesdelarte.org/current/web/app/themes/mrg/dist/images/svg/flecha-aba-peq.svg
I've seen older issues with the same error that seems to be fixed but I'm getting this error with a fresh install of Sage and blade-svg-sage.