tobimori / kirby-icon-field

🏷️ A simple Icon field plugin for Kirby CMS.
https://getkirby.com/plugins/tobimori/icon-field
MIT License
38 stars 4 forks source link

Incorrect sprite path in icon preview #18

Closed jan-herman closed 3 weeks ago

jan-herman commented 4 weeks ago

Hi there, when using the sprite option, the icon previews have the wrong sprite path (folder is missing). See the field configuration and screenshot below. The options are loaded correctly from the specified sprite, but the sprite path for the icon preview is wrong.

label: field.icon.label
type: icon
folder: assets/images
sprite: icons.svg
max: 1

SCR-20241017-nvl

tobimori commented 4 weeks ago

What does your folder setup look like? I run this in a subfolder without issues.

Can you debug further where the folder gets replaced? In the code it uses the folder. https://github.com/tobimori/kirby-icon-field/blob/main/index.php#L153

jan-herman commented 3 weeks ago

Oh, my bad. I'm using the public folder setup and I'm using symlink for the assets folder so I can use them inside src with Vite. That's why $this->folder() returns the path to src instead of the public directory.

Meaning it will work in production, but I guess it's time for me to stop being lazy and move the static assets to a separate directory :D