|
@@ -1181,7 +1181,12 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
} else if (cssRule.type == "Atrule" && cssRule.name == "font-face") {
|
|
} else if (cssRule.type == "Atrule" && cssRule.name == "font-face") {
|
|
|
await Promise.all(cssRule.block.children.toArray().map(async declaration => {
|
|
await Promise.all(cssRule.block.children.toArray().map(async declaration => {
|
|
|
if (declaration.type == "Declaration") {
|
|
if (declaration.type == "Declaration") {
|
|
|
- const declarationValue = cssTree.generate(declaration.value);
|
|
|
|
|
|
|
+ let declarationValue = "";
|
|
|
|
|
+ try {
|
|
|
|
|
+ declarationValue = cssTree.generate(declaration.value);
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ // ignored
|
|
|
|
|
+ }
|
|
|
const urlFunctions = DomUtil.getUrlFunctions(declarationValue); // TODO: use OM
|
|
const urlFunctions = DomUtil.getUrlFunctions(declarationValue); // TODO: use OM
|
|
|
await Promise.all(urlFunctions.map(async urlFunction => {
|
|
await Promise.all(urlFunctions.map(async urlFunction => {
|
|
|
const originalResourceURL = DomUtil.matchURL(urlFunction);
|
|
const originalResourceURL = DomUtil.matchURL(urlFunction);
|
|
@@ -1197,7 +1202,13 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
content = EMPTY_DATA_URI;
|
|
content = EMPTY_DATA_URI;
|
|
|
}
|
|
}
|
|
|
declaration.value.children.forEach(token => {
|
|
declaration.value.children.forEach(token => {
|
|
|
- if (token.type == "Url" && DOM.removeQuotes(cssTree.generate(token.value, "value")) == originalResourceURL) {
|
|
|
|
|
|
|
+ let tokenValue = "";
|
|
|
|
|
+ try {
|
|
|
|
|
+ tokenValue = cssTree.generate(token.value);
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ // ignored
|
|
|
|
|
+ }
|
|
|
|
|
+ if (token.type == "Url" && DOM.removeQuotes(tokenValue == originalResourceURL) {
|
|
|
token.value.value = content;
|
|
token.value.value = content;
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|