-
-
Notifications
You must be signed in to change notification settings - Fork 288
Open
Description
The Kirby 4 release notes include a section dedicated to plugin assets:
Better plugin asset handling
- New
assetsplugin extension that allows plugins to specify assets from custom paths and with a wider range of extensions than previously supported- New
Kirby\Cms\Plugin::assets()andKirby\Cms\Plugin::asset($assetName)methods- New
Kirby\Cms\PluginAssetobject with many methods, e.g.$plugin->asset('styles.css')->url()- Plugin asset media url contains a modification timestamp to easily cachebust (e.g.
/media/plugins/getkirby/test-plugin/2375797551-472389240/styles.css)css()andjs()helpers support passing plugin and plugin assets objects to include all assets of the plugin:css([ 'assets/css/index.css', $kirby->plugin('foo/bar') ]); css([ 'assets/css/index.css', $kirby->plugin('foo/bar')->assets(), ]); css([ 'assets/css/index.css', $kirby->plugin('foo/bar')->asset('styles.css'), ]);
The Custom plugins page includes a short section on plugin assets, but does not include details on how to access them in templates.
I missed the release notes so I went on a tangent trying to figure out content hashing for plugin assets, so more visibility to the fact that these can already be hashed with core functionality would be welcome. Is it treated in another section of the docs?
If not, I would make a PR to add this info to the Custom plugins page, if that’s the best place for it.
Note that as of Kirby 5.1.3, some of these helpers are broken, but trivial to fix.
Metadata
Metadata
Assignees
Labels
No labels