Closed seehat closed 3 years ago
the build in snippet has no support for that yet. https://github.com/bnomei/kirby3-htmlhead/blob/master/snippets/htmlhead/script-js.php
but you could create your own snippet and just add its filename with to the plugins config array. like here but indead of htmlhead/script-js
you could use your snippets filename.
TIP: thats how you can basically add anything to this plugin. snippets ftw. :D
Ok thank you for your tip! I know this and thought that it would make sense in core, but it's ok for me, when it stays like this.
@seehat new in https://github.com/bnomei/kirby3-htmlhead/releases/tag/v2.1.9
'htmlhead/script-js' => function ($kirby, $site, $page) {
return ['files' => [
// NEW !! ARRAY
[
'src' => 'somescript.js',
'async' => true,
],
'/assets/app.js', // STRING
'https://cdn.jsdelivr.net/npm/webfontloader@1.6.28/webfontloader.min.js|sha256-4O4pS1SH31ZqrSO2A/2QJTVjTPqVe+jnYgOWUVr7EEc=', // STRING|INTEGRIY
]];
},
Is there a way to output scripts with the
async
attribute?If not can you add it?