浏览代码

静态资源压缩命令优化

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