Skip to content

Commit

Permalink
fix(task:purgecss): ignore id attribute on inline styles
Browse files Browse the repository at this point in the history
  • Loading branch information
mohatt committed Jul 29, 2021
1 parent 7fceb3e commit 332f797
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/tasks/purgecss/lib/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,7 @@ export class HtmlContext {
if (node.childNodes.length === 0) return
const style = new StyleInline(node.childNodes[0] as parse5.TextNode)
if (this._inHead) {
const idAttr = node.attrs.find(a => a.name === 'id')
style.id = idAttr !== undefined && idAttr.value !== ''
? idAttr.value
: createStyleId(style.read())
style.id = createStyleId(style.read())
this.mapper.createStyleLink(style, this)
}
this.styles.push(style)
Expand Down

0 comments on commit 332f797

Please sign in to comment.