Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add more options to include script #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eliyabar
Copy link

@eliyabar eliyabar commented Jan 25, 2023

Hey, the following use-case was needed for my personal use:

  1. Use an external script
  2. Initialize it with some values.

The existing option is only to create a deferrable script tag. and one more thing, the inline script was rendered before the script tag, for example:
this config

...
    "scripts" : {
      "urls"   : ["some link"],
      "inline" : ["init({someArgs})"]
    },
...

will result:

....
    <script>
      init({someArgs})
    </script>
    <script src="some link" defer></script>
...

In my case, the order of the script tag and inline script is reversed. moreover, you can also create a non deferable script tag like so:

...
    "scripts" : {
      "urls"   : [{"url": "https://somescript/index.js", "defer": false}],
      "inline" : []
    },
...

IDK how needed it is, but it helped me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant