Skip to content

Commit

Permalink
feat: write cspNonce to style tags
Browse files Browse the repository at this point in the history
  • Loading branch information
thebanjomatic committed Apr 13, 2024
1 parent 76b0efb commit 80795cc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/vite/src/node/plugins/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1182,6 +1182,7 @@ export function injectNonceAttributeTagHook(

if (
node.nodeName === 'script' ||
node.nodeName === 'style' ||
(node.nodeName === 'link' &&
node.attrs.some(
(attr) =>
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 nonce="#$NONCE$#">
<style>
.inline {
color: green;
}
Expand Down

0 comments on commit 80795cc

Please sign in to comment.