async-script-loader icon indicating copy to clipboard operation
async-script-loader copied to clipboard

Suggestion: allow other attributes in options besides async and defer

Open colinhowells opened this issue 2 years ago • 0 comments
trafficstars

A common use case with third-party libraries is they expect to have an id, something like

<script id="exampleScript123" src="https://example.com/somefile.js" async defer="defer"></script>

Sometimes data attributes are requested as well:

<script data-something="exampleData" src="https://example.com/somefile.js" async defer></script>

In these cases, I use svelte:head, but it would be nice to have this use case handled by this great tool ... if you'd like a PR maybe I can do one up for you.

loader([
    { type: 'script', url, options: { id: "exampleScript123", data-something: "exampleData" } }
  ], test, callback)

colinhowells avatar Jul 25 '23 19:07 colinhowells