Plugin asset url helper?


The docs tell me that assets for plugins are accessible at the /media/plugins/superwoman/superplugin/fields/myfield.1520265293.js URL. But how do I know that URL, specifically the fingerprinting part?

I’ve tried just using the js() helper like this:

<?= js('media/plugins/superwoman/superplugin/myfield.js') ?>
//and also with
<?= js('/media/plugins/superwoman/superplugin/myfield.js') ?>

It works, in the sense that the asset is reachable like that, but the helper doesn’t add the fingerprint; it just comes out as:

<script src="">

I get the same result. Maybe that is intended behavior if you call the assets on the frontend.

Maybe it’s intended, but shouldn’t there be a way to get an URL like the one mentioned in the docs?

There is the PluginAssets::resolve() function that, based on its description, almost seems to do this… But looking at its implementation, I see that it’s not really something you want to do on every page load (it deletes and creates files, seemingly every time). And it also does no fingerprinting.