فهرست منبع

静态资源压缩命令优化

jqh 5 سال پیش
والد
کامیت
9ef65d4f6d
1فایلهای تغییر یافته به همراه9 افزوده شده و 4 حذف شده
  1. 9 4
      src/Console/MinifyCommand.php

+ 9 - 4
src/Console/MinifyCommand.php

@@ -136,11 +136,16 @@ class MinifyCommand extends Command
      */
     protected function backupFiles()
     {
-        $this->files->delete($this->getMixBakFile());
-        $this->files->copy($this->getMixFile(), $this->getMixBakFile());
+        if (! is_file($this->getMixBakFile())) {
+            $this->files->copy($this->getMixFile(), $this->getMixBakFile());
+        } else {
+            $this->files->delete($this->getMixFile());
+            $this->files->copy($this->getMixBakFile(), $this->getMixFile());
+        }
 
-        $this->files->delete($this->getColorBakFile());
-        $this->files->copy($this->getColorFile(), $this->getColorBakFile());
+        if (! is_file($this->getColorBakFile())) {
+            $this->files->copy($this->getColorFile(), $this->getColorBakFile());
+        }
     }
 
     /**