소스 검색

fixed issue when } is preceded by \ and a space

Gildas 7 년 전
부모
커밋
5c885306ab
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      lib/single-file/vendor/css-minifier.js

+ 3 - 1
lib/single-file/vendor/css-minifier.js

@@ -358,7 +358,8 @@ this.cssMinifier = this.cssMinifier || (() => {
 	const REGEXP_PRESERVE_CALC3 = / \)/g;
 	const REGEXP_PRESERVE_MATRIX = /\s*filter:\s*progid:DXImageTransform.Microsoft.Matrix\(([^)]+)\);/g;
 	const REGEXP_REMOVE_SPACES = /(^|\})(([^{:])+:)+([^{]*{)/g;
-	const REGEXP_REMOVE_SPACES2 = /\s+([!{};:>+()\],])/g;
+	const REGEXP_REMOVE_SPACES2 = /\s+([!{;:>+()\],])/g;
+	const REGEXP_REMOVE_SPACES2_BIS = /[^\\]\s+([}])/g;
 	const REGEXP_RESTORE_SPACE_IMPORTANT = /!important/g;
 	const REGEXP_PSEUDOCLASSCOLON = /___PSEUDOCLASSCOLON___/g;
 	const REGEXP_COLUMN = /:/g;
@@ -539,6 +540,7 @@ this.cssMinifier = this.cssMinifier || (() => {
 
 		// remove spaces before the things that should not have spaces before them.
 		content = content.replace(REGEXP_REMOVE_SPACES2, "$1");
+		content = content.replace(REGEXP_REMOVE_SPACES2_BIS, "$1");
 
 		// restore spaces for !important
 		content = content.replace(REGEXP_RESTORE_SPACE_IMPORTANT, " !important");