We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
nonce
1 parent dd98a7a commit fa2c00aCopy full SHA for fa2c00a
packages/core/useStyleTag/index.ts
@@ -30,6 +30,13 @@ export interface UseStyleTagOptions extends ConfigurableDocument {
30
* @default auto-incremented
31
*/
32
id?: string
33
+
34
+ /**
35
+ * Nonce value for CSP (Content Security Policy)
36
+ *
37
+ * @default undefined
38
+ */
39
+ nonce?: string
40
}
41
42
export interface UseStyleTagReturn {
@@ -75,6 +82,8 @@ export function useStyleTag(
75
82
76
83
if (!el.isConnected) {
77
84
el.id = id
85
+ if (options.nonce)
86
+ el.nonce = options.nonce
78
87
if (options.media)
79
88
el.media = options.media
80
89
document.head.appendChild(el)
0 commit comments