File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 33 * @Author: nguyen
44 * @Date: 2020-02-12 14:01:01
55 * @Last Modified by: Alex Dong
6- * @Last Modified time: 2020-05-21 15:07:46
6+ * @Last Modified time: 2020-11-06 14:06:27
77 */
88
99namespace Magepow \SpeedOptimizer \Plugin ;
@@ -320,7 +320,9 @@ public function minifyJs($script)
320320 '' ,
321321 '\\1 ' ,
322322 );
323- return preg_replace ($ search , $ replace , $ script );
323+ $ minScript = preg_replace ($ search , $ replace , $ script );
324+ /* Return $script when $minScript empty */
325+ return $ minScript ? $ minScript : $ script ;
324326 }
325327
326328 public function minifyHtml ($ content )
@@ -341,7 +343,9 @@ public function minifyHtml($content)
341343 // ''
342344 );
343345
344- return preg_replace ($ search , $ replace , $ content );
346+ $ minHtml = preg_replace ($ search , $ replace , $ content );
347+ /* Return $content when $minHtml empty */
348+ return $ minHtml ? $ minHtml : $ content ;
345349 }
346350
347351 public function addLoading ($ content )
You can’t perform that action at this time.
0 commit comments