|
|
@@ -888,7 +888,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
if (this.options.compressCSS) {
|
|
|
styleContent = util.compressCSS(styleContent);
|
|
|
}
|
|
|
- styleContent = ProcessorHelper.resolveStylesheetURLs(styleContent, this.baseURI);
|
|
|
+ styleContent = ProcessorHelper.resolveStylesheetURLs(styleContent, this.baseURI, this.workStyleElement);
|
|
|
const declarationList = cssTree.parse(styleContent, { context: "declarationList" });
|
|
|
this.styles.set(element, declarationList);
|
|
|
});
|
|
|
@@ -1547,7 +1547,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
}
|
|
|
|
|
|
static async resolveImportURLs(stylesheetContent, baseURI, options, workStylesheet, importedStyleSheets = new Set()) {
|
|
|
- stylesheetContent = ProcessorHelper.resolveStylesheetURLs(stylesheetContent, baseURI);
|
|
|
+ stylesheetContent = ProcessorHelper.resolveStylesheetURLs(stylesheetContent, baseURI, workStylesheet);
|
|
|
const imports = getImportFunctions(stylesheetContent);
|
|
|
await Promise.all(imports.map(async cssImport => {
|
|
|
const match = matchImport(cssImport);
|
|
|
@@ -1596,11 +1596,15 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
return stylesheetContent;
|
|
|
}
|
|
|
|
|
|
- static resolveStylesheetURLs(stylesheetContent, baseURI) {
|
|
|
+ static resolveStylesheetURLs(stylesheetContent, baseURI, workStylesheet) {
|
|
|
const urlFunctions = getUrlFunctions(stylesheetContent, true);
|
|
|
urlFunctions.map(urlFunction => {
|
|
|
const originalResourceURL = matchURL(urlFunction);
|
|
|
- const resourceURL = normalizeURL(originalResourceURL);
|
|
|
+ let resourceURL = normalizeURL(originalResourceURL);
|
|
|
+ workStylesheet.textContent = "tmp { content:\"" + resourceURL + "\"}";
|
|
|
+ if (workStylesheet.sheet && workStylesheet.sheet.cssRules) {
|
|
|
+ resourceURL = util.removeQuotes(workStylesheet.sheet.cssRules[0].style.getPropertyValue("content"));
|
|
|
+ }
|
|
|
if (!testIgnoredPath(resourceURL)) {
|
|
|
if (!resourceURL || testValidPath(resourceURL)) {
|
|
|
let resolvedURL;
|