瀏覽代碼

replace the matching URL

Gildas 7 年之前
父節點
當前提交
fbc0540062
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      lib/single-file/single-file-core.js

+ 2 - 2
lib/single-file/single-file-core.js

@@ -1257,7 +1257,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 								if (duplicate && options.groupDuplicateImages) {
 									const tokens = [];
 									for (let token = declaration.value.children.head; token; token = token.next) {
-										if (token.data.type == "Url") {
+										if (token.data.type == "Url" && cssTree.generate(token.data.value) == originalResourceURL) {
 											const value = cssTree.parse("var(" + SINGLE_FILE_VARIABLE_NAME_PREFIX + indexResource + ")", { context: "value" }).children.head;
 											tokens.push({ token, value });
 										}
@@ -1266,7 +1266,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 									cssVariables.set(indexResource, content);
 								} else {
 									declaration.value.children.forEach(token => {
-										if (token.type == "Url") {
+										if (token.type == "Url" && cssTree.generate(token.value) == originalResourceURL) {
 											token.value.value = content;
 										}
 									});