VSCode-sftp插件

項目送測以前用的是gitlab-ci,在服務器上先build,而後run,結果build過程vue項目太慢、太費內存,因此想直接在本地build完後打包上傳到服務器,因而找了個VSCode上的插件在同步文件.vue

1.安裝sftp插件

直接擴展裏搜索sftp便可。git

2.配置

Ctrl+Shift+P打開命令行,輸入SFTP:config,會在.vscode目錄裏新建文件sftp.json,輸入如下配置信息github

{
    "host": "xxxx",
    "protocol": "sftp",
    "port": 22,
    "username": "username",
    "password": "password",
    "remotePath": "/home/ysn/front/ops", //遠程服務器目錄
    "syncOption": {
      "delete": true
    },
    "watcher": {
      "files": "dist/", //監聽本地文件夾更新或刪除時自動上傳
      "autoUpload": true,
      "autoDelete": true
    }
}

這樣運行npm test後;本地dist目錄發生改變後,會同步到遠程服務器上的目錄裏。npm

sftp githubjson

相關文章
相關標籤/搜索