Get to assets / url in plugin

couldn’t find a tool to get an assets url from within a plugin. i guess hardcoding the url isn’t the best idea? just when it is supposed to copy files to the media folder, so i wonder,

how to e.g. access echo

plugins/my-plugin/assets/css/some-css.css

(or any other asset - svg, js, css, logo)

You can most of the path with root(‘plugins’) but that only gets you as far as the plugins folder. I think you need to hard code the rest of the path. Looking at a couple of plugins that use assets, that seems to be what people have done.

I think if its something that gets copied to the media folder, you can reach it with url(‘media’) or root(‘media’) + your plugin name etc

https://getkirby.com/docs/guide/plugins/plugin-basics#plugin-assets

i was wondering about that…
when i hardcode / use the direct url it’s not using the js/css how it’s written there… there’s no copy in media folder, no timestamp, so there must be another solution…

use core css and js helpers and plugins/$pluginDeveloper/$pluginName/$assetpath. there seems to be some routing magic happening. i have not tried this myself but…