소스 검색

静态资源压缩命令优化

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());
+        }
     }
 
     /**