Skip to content

Commit

Permalink
fix(tags): remove duplicate scripts (#198) (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
BulatNsbln authored Nov 11, 2020
1 parent 0716aa9 commit f069e57
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ function getNecessaryScripts (tags, cdnBase = 'https://cdn.ampproject.org/v0/',
const detectedTags = Object.keys(tags)
.filter(tag => filterTag(html, tag, tags[tag]))
.map(tag => generateScript(cdnBase, tag, tags[tag]))
return detectedTags.join('')

const distinctDetectedTags = [...new Set(detectedTags)]

return distinctDetectedTags.join('')
}

module.exports = {
Expand Down

0 comments on commit f069e57

Please sign in to comment.