@@ -163,11 +163,19 @@ public function adjust_breakpoints( $css ) {
163163 return $ css ;
164164 }
165165
166- if ( ! empty ( $ new_tablet ) && ( strpos ( $ css , 'width:1024px) ' ) !== false || strpos ( $ css , 'width:1023px) ' ) !== false ) ) {
166+ // Handle CSS optimized values where there are no spaces between the
167+ // colon and the value and if there is a space between the colon and
168+ // the value.
169+ if ( ! empty ( $ new_tablet ) &&
170+ ( strpos ( $ css , 'width:1024px) ' ) !== false || strpos ( $ css , 'width:1023px) ' ) !== false ||
171+ strpos ( $ css , 'width: 1024px) ' ) !== false || strpos ( $ css , 'width: 1023px) ' ) !== false )
172+ ) {
167173
168174 // Check if the style generated contains new breakpoints
169- $ has_new_tablet = strpos ( $ css , 'width: ' . $ new_tablet . 'px) ' ) !== false ;
170- $ has_new_tablet_minus_1 = strpos ( $ css , 'width: ' . ( $ new_tablet - 1 ) . 'px) ' ) !== false ;
175+ $ has_new_tablet = strpos ( $ css , 'width: ' . $ new_tablet . 'px) ' ) !== false ||
176+ strpos ( $ css , 'width: ' . $ new_tablet . 'px) ' ) !== false ;
177+ $ has_new_tablet_minus_1 = strpos ( $ css , 'width: ' . ( $ new_tablet - 1 ) . 'px) ' ) !== false ||
178+ strpos ( $ css , 'width: ' . ( $ new_tablet - 1 ) . 'px) ' ) !== false ;
171179
172180 if ( ! $ has_new_tablet ) {
173181 $ css = preg_replace ( "/(@media[^{]+)width:\s*1024px/ " , "$1width: " . $ new_tablet . "px " , $ css );
@@ -179,10 +187,15 @@ public function adjust_breakpoints( $css ) {
179187 }
180188
181189 // Mobile version
182- if ( ! empty ( $ new_mobile ) && ( strpos ( $ css , 'width:768px) ' ) !== false || strpos ( $ css , 'width:767px) ' ) !== false ) ) {
183-
184- $ has_new_mobile = strpos ( $ css , 'width: ' . $ new_mobile . 'px) ' ) !== false ;
185- $ has_new_mobile_minus_1 = strpos ( $ css , 'width: ' . ( $ new_mobile - 1 ) . 'px) ' ) !== false ;
190+ if ( ! empty ( $ new_mobile ) &&
191+ ( strpos ( $ css , 'width:768px) ' ) !== false || strpos ( $ css , 'width:767px) ' ) !== false ||
192+ strpos ( $ css , 'width: 768px) ' ) !== false || strpos ( $ css , 'width: 767px) ' ) !== false )
193+ ) {
194+
195+ $ has_new_mobile = strpos ( $ css , 'width: ' . $ new_mobile . 'px) ' ) !== false ||
196+ strpos ( $ css , 'width: ' . $ new_mobile . 'px) ' ) !== false ;
197+ $ has_new_mobile_minus_1 = strpos ( $ css , 'width: ' . ( $ new_mobile - 1 ) . 'px) ' ) !== false ||
198+ strpos ( $ css , 'width: ' . ( $ new_mobile - 1 ) . 'px) ' ) !== false ;
186199
187200 if ( ! $ has_new_mobile ) {
188201 $ css = preg_replace ( "/(@media[^{]+)width:\s*768px/ " , "$1width: " . $ new_mobile . "px " , $ css );
0 commit comments