Просмотр исходного кода

always remove comments from CSS contents

Gildas 7 лет назад
Родитель
Сommit
1a48a5a798
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      lib/single-file/single-file-core.js

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

@@ -1143,8 +1143,9 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 						if (DomUtil.testValidURL(resourceURL, baseURI, options.url)) {
 							const downloadOptions = { asDataURI: false, maxResourceSize: options.maxResourceSize, maxResourceSizeEnabled: options.maxResourceSizeEnabled, validateTextContentType: true };
 							let importedStylesheetContent = await Download.getContent(resourceURL, downloadOptions);
+							importedStylesheetContent = DomUtil.removeCssComments(importedStylesheetContent);
 							if (options.compressCSS) {
-								importedStylesheetContent = DOM.compressCSS(DomUtil.removeCssComments(importedStylesheetContent));
+								importedStylesheetContent = DOM.compressCSS(importedStylesheetContent);
 							}
 							importedStylesheetContent = DomUtil.wrapMediaQuery(importedStylesheetContent, match.media);
 							if (stylesheetContent.includes(cssImport)) {
@@ -1187,8 +1188,9 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 			if (resourceURL && resourceURL != baseURI && resourceURL != ABOUT_BLANK_URI) {
 				const downloadOptions = { asDataURI: false, maxResourceSize: options.maxResourceSize, maxResourceSizeEnabled: options.maxResourceSizeEnabled, charSet: options.charSet };
 				let stylesheetContent = await Download.getContent(resourceURL, downloadOptions);
+				stylesheetContent = DomUtil.removeCssComments(stylesheetContent);
 				if (options.compressCSS) {
-					stylesheetContent = DOM.compressCSS(DomUtil.removeCssComments(stylesheetContent));
+					stylesheetContent = DOM.compressCSS(stylesheetContent);
 				}
 				stylesheetContent = await DomProcessorHelper.resolveImportURLs(stylesheetContent, resourceURL, options);
 				return stylesheetContent;