Skip to content

Commit

Permalink
fix: 🐛 html tag location in head
Browse files Browse the repository at this point in the history
closes #7
  • Loading branch information
josh-hemphill committed Jun 1, 2022
1 parent 7f870bc commit fc939b2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ class HtmlTag implements HtmlTagDescriptor {
}
}

class HtmlHeadTag extends HtmlTag {
injectTo = 'head' as const;
}

export type ViteCspPluginOptions = typeof DEFAULT_OPTIONS;

type ViteCspPluginOpts = Partial<ViteCspPluginOptions>
Expand Down Expand Up @@ -243,7 +247,7 @@ function createViteCspPlugin(...opts: ([PolicyOptions, ViteCspPluginOpts] | [Vit
if (inject) {
return Object.entries(parsedHeaders)
.filter(([k]) => injectReporting || !k.includes('Report'))
.map(([k, v]) => new HtmlTag('meta', {
.map(([k, v]) => new HtmlHeadTag('meta', {
'http-equiv': k,
content: v,
}));
Expand Down

0 comments on commit fc939b2

Please # to comment.