Skip to content
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

Help with SVG path for typical WP setup #15

Closed
djmtype opened this issue May 31, 2022 · 6 comments
Closed

Help with SVG path for typical WP setup #15

djmtype opened this issue May 31, 2022 · 6 comments

Comments

@djmtype
Copy link

djmtype commented May 31, 2022

Relative path (with dot notation) – resolves to app/themes/<your theme>/dist/images/logo.svg by default
@svg('images.logo')

Using Sage 10, I have a typical Wordpress setup where all my svgs live in wp-content/themes/<my-sage-theme>/resources/images/svg/*.svg. Upon build, all images including svgs get dumped into public, at the root for some reason, not inside an images directory.

With that said, what would be the relative path? Is it relative to production or development?

I tried @svg('resources/images/svg/my-icon') and @svg('my-icon') – neither work.

@djmtype
Copy link
Author

djmtype commented May 31, 2022

The plugin doesn't seem to be working for me. Example, if I type out @svg() in a blade template without any parameters, I don't get any PHP errors – it just prints out in plain text.

@djmtype
Copy link
Author

djmtype commented Jun 1, 2022

This seems to work: {{ get_svg('svg.logo') }}
But not this: @svg('svg.logo')

@Log1x
Copy link
Owner

Log1x commented Jun 16, 2022

Sorry for the late reply.

Did you try wp acorn optimize:clear to clear view cache?

@tomrx
Copy link

tomrx commented Jul 28, 2022

Sorry for the late reply.

Did you try wp acorn optimize:clear to clear view cache?

This fixed it for me. Thanks.

@djmtype
Copy link
Author

djmtype commented Sep 1, 2022

@Log1x Running wp acorn optimize:clear via wp cli didn't seem to work for me.

I can't tell if the command was successful either as I'm using Local (by Flywheel) on an ARM Mac, but the application is written for Intel.

❯ wp acorn optimize:clear
Failed loading /Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-7.4.1+18/bin/darwin/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so:  dlopen(/Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-7.4.1+18/bin/darwin/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so, 0x0009): tried: '/Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-7.4.1+18/bin/darwin/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))

Warning: PHP Startup: Unable to load dynamic library '/Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-7.4.1+18/bin/darwin/lib/php/extensions/no-debug-non-zts-20190902/imagick.so' (tried: /Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-7.4.1+18/bin/darwin/lib/php/extensions/no-debug-non-zts-20190902/imagick.so (dlopen(/Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-7.4.1+18/bin/darwin/lib/php/extensions/no-debug-non-zts-20190902/imagick.so, 0x0009): tried: '/Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-7.4.1+18/bin/darwin/lib/php/extensions/no-debug-non-zts-20190902/imagick.so' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))), /opt/homebrew/Cellar/php@7.4/7.4.30/lib/php/20190902//Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-7.4.1+18/bin/darwin/lib/php/extensions/no-debug-non-zts-20190902/imagick.so.so (dlopen(/opt/homeb in Unknown on line 0
Compiled views cleared!
Configuration cache cleared!
Compiled services and packages files removed!
Caches cleared successfully!

@djmtype
Copy link
Author

djmtype commented Sep 1, 2022

{{ get_svg('svg.logo') }} no longer seems to work with Sage 10.2 either. Now this is the correct implementation: {{ get_svg('images.svg.logo') }}. Sage seems to dump the svg directory into images by default, so they have to correspond. I'm sure there's some Laravel or Bud workaround, but that's perfectly fine.

@svg('images.svg.logo') now seems to work as well after clearing the acorn cache with wp acorn optimize:clear, I think.

@Log1x Log1x closed this as completed Dec 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants