|
|
@@ -1708,7 +1708,15 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
|
|
|
static async processStyle(declarations, baseURI, options, cssVariables, batchRequest) {
|
|
|
await Promise.all(declarations.map(async declaration => {
|
|
|
- if (declaration.type == "Declaration" && declaration.value.children) {
|
|
|
+ let children = declaration.value.children;
|
|
|
+ if (!children && declaration.value && declaration.value.type == "Raw") {
|
|
|
+ try {
|
|
|
+ children = cssTree.parse(declaration.value.value, { context: "value" }).children;
|
|
|
+ } catch (error) {
|
|
|
+ // ignored
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (declaration.type == "Declaration" && children) {
|
|
|
const urlFunctions = getUrlFunctions(getCSSValue(declaration.value));
|
|
|
await Promise.all(urlFunctions.map(async urlFunction => {
|
|
|
const originalResourceURL = matchURL(urlFunction);
|
|
|
@@ -1718,7 +1726,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
let { content, indexResource, duplicate } = await batchRequest.addURL(resourceURL, true, "image", true);
|
|
|
let variableDefined;
|
|
|
const tokens = [];
|
|
|
- findURLToken(originalResourceURL, declaration.value.children, (token, parent, rootFunction) => {
|
|
|
+ findURLToken(originalResourceURL, children, (token, parent, rootFunction) => {
|
|
|
if (!originalResourceURL.startsWith("#")) {
|
|
|
if (duplicate && options.groupDuplicateImages && rootFunction && util.getContentSize(content) < SINGLE_FILE_VARIABLE_MAX_SIZE) {
|
|
|
const value = cssTree.parse("var(" + SINGLE_FILE_VARIABLE_NAME_PREFIX + indexResource + ")", { context: "value" }).children.head;
|