Skip to content

Commit 020c971

Browse files
committed
feat: don't add nonce attribute to style tags
1 parent d17074b commit 020c971

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

packages/vite/src/node/plugins/html.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,8 +1173,7 @@ export function injectNonceAttributeTagHook(
11731173
(attr) =>
11741174
attr.name === 'rel' &&
11751175
parseRelAttr(attr.value).some((a) => processRelType.has(a)),
1176-
)) ||
1177-
(node.nodeName === 'style' && node.childNodes.length)
1176+
))
11781177
) {
11791178
s.appendRight(
11801179
node.sourceCodeLocation!.startTag!.endOffset - 1,

playground/csp/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<link rel="stylesheet" href="./linked.css" />
2-
<style>
2+
<style nonce="#$NONCE$#">
33
.inline {
44
color: green;
55
}

0 commit comments

Comments
 (0)