-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat(qwik-city): add a scripts key to head #3182
Conversation
Allow for injecting custom scripts 2593
Run & review this pull request in StackBlitz Codeflow. |
async?: string; | ||
crossorigin?: string; | ||
defer?: string; | ||
fectpriority?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fetchpriority
I'm guessing
Should the starter and the docs files be updated too? |
type?: string; | ||
importmap?: string; | ||
blocking?: string; | ||
id?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there also be a property to have a script which might go inside the script tag, maybe script
or innerHtml
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you think about using the HTMLScriptElement
typing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think 🤔 there is not extra property for that. Please check the official specifications here.
Or do you meant like a custom
property?
Like this (?): {head.scripts.map((sc) => (
<script {...sc}></script>
))} |
Something like the following maybe: {head.scripts.map(({ script, ...props }) => (
<script {...props} dangerouslySetInnerHTML={script} />
))} Similar to how it's down for the style tag, https://github.com/BuilderIO/qwik/blob/7a0e9f1f02cf6bfb33658722e02e22789f6a6aee/packages/docs/src/components/router-head/router-head.tsx#L46 |
I also worked on this before I saw your PR, maybe I can push my version later today as it had much more in depth changes. |
Sorry for creating another PR. This is what I was proposing: |
Allow for injecting custom scripts
#2593
What is it?
Description
Added a scripts key to head to allow for injecting custom scripts.
Checklist: