|
|
@@ -2034,7 +2034,19 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
}
|
|
|
|
|
|
function removeCssComments(stylesheetContent) {
|
|
|
- return stylesheetContent.replace(/\/\*(.|\s)*?\*\//g, "");
|
|
|
+ try {
|
|
|
+ return stylesheetContent.replace(/\/\*(.|\s)*?\*\//g, "");
|
|
|
+ } catch (error) {
|
|
|
+ let start, end;
|
|
|
+ do {
|
|
|
+ start = stylesheetContent.indexOf("/*");
|
|
|
+ end = stylesheetContent.indexOf("*/", start + 2);
|
|
|
+ if (start != -1 && end != -1) {
|
|
|
+ stylesheetContent = stylesheetContent.substring(0, start) + stylesheetContent.substr(end + 2);
|
|
|
+ }
|
|
|
+ } while (start != -1 && end != -1);
|
|
|
+ return stylesheetContent;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
function wrapMediaQuery(stylesheetContent, mediaQuery) {
|