From f069e572aef3db5d93320070bb4634c75cccf0e5 Mon Sep 17 00:00:00 2001 From: BulatNsbln Date: Wed, 11 Nov 2020 20:32:50 +0400 Subject: [PATCH] fix(tags): remove duplicate scripts (#198) (#199) --- lib/tags.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/tags.js b/lib/tags.js index ff03453a..d752c760 100644 --- a/lib/tags.js +++ b/lib/tags.js @@ -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 = {