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

相关文章
相关标签/搜索