Преглед изворни кода

remove unused fonts when remove unused styles option is active

Gildas пре 7 година
родитељ
комит
b1d2a6c930
2 измењених фајлова са 3 додато и 3 уклоњено
  1. 2 2
      lib/single-file/doc-helper.js
  2. 1 1
      lib/single-file/single-file-core.js

+ 2 - 2
lib/single-file/doc-helper.js

@@ -64,7 +64,7 @@ this.docHelper = this.docHelper || (() => {
 		if (win) {
 			canvasData = getCanvasData(doc, win);
 			imageData = getImageData(doc, win, options);
-			if (options.removeHiddenElements || options.removeAlternativeFonts || options.compressHTML) {
+			if (options.removeHiddenElements || options.removeUnusedStyles || options.compressHTML) {
 				let styles = getStyles(win, doc.body);
 				if (options.removeHiddenElements) {
 					const markerRemovedContent = removedContentAttributeName(options.sessionId);
@@ -83,7 +83,7 @@ this.docHelper = this.docHelper || (() => {
 					});
 					styles = new Map(Array.from(styles).filter(([element]) => element.getAttribute(markerRemovedContent) != ""));
 				}
-				if (options.removeAlternativeFonts) {
+				if (options.removeUnusedStyles) {
 					usedFonts = getUsedFonts(styles);
 				}
 				if (options.compressHTML) {

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

@@ -109,7 +109,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 		sequential: [
 			{ option: "removeUnusedStyles", action: "removeUnusedStyles" },
 			{ option: "removeAlternativeMedias", action: "removeAlternativeMedias" },
-			{ option: "removeAlternativeFonts", action: "removeUnusedFonts" }
+			{ option: "removeUnusedStyles", action: "removeUnusedFonts" }
 		],
 		parallel: [
 			{ action: "processStylesheets" },