Skip to content

Commit

Permalink
feat: don't add nonce attribute to style tags
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Feb 29, 2024
1 parent d17074b commit 020c971
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions packages/vite/src/node/plugins/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1173,8 +1173,7 @@ export function injectNonceAttributeTagHook(
(attr) =>
attr.name === 'rel' &&
parseRelAttr(attr.value).some((a) => processRelType.has(a)),
)) ||
(node.nodeName === 'style' && node.childNodes.length)
))
) {
s.appendRight(
node.sourceCodeLocation!.startTag!.endOffset - 1,
Expand Down
2 changes: 1 addition & 1 deletion playground/csp/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<link rel="stylesheet" href="./linked.css" />
<style>
<style nonce="#$NONCE$#">
.inline {
color: green;
}
Expand Down

0 comments on commit 020c971

Please sign in to comment.