将 Vue.js 应用程序上传到 GitHub 的正确方法是什么?
What is the proper way to upload a Vue.js app to GitHub?
我试过 uploading my files to Github,但是 GitHub 说它太大了。
然后我在构建生产后上传了 dist
文件夹的内容。
这工作得很好,但不是很有用。
将 Vue.js 应用程序上传到 GitHub 的正确方法是什么?
您生成的(可能很大的二进制文件)不应该versioned/pushed到GitHub。
最好使用本地插件,它会在 GitHub 端构建、标记和发布与您的项目关联的版本。
您可以将其与 GitHub 操作结合使用,它可以获取该版本,并将其部署到您选择的远程服务器上(前提是可以从 GitHub 公开访问):参见例如“How to deploy your VueJS using Github Actions (on Firebase Hosting)" from John Kilonzi.
对于您现有的 dist,您应该删除它(仅从 Git,而不是您的磁盘)并将其添加到您的 .gitignore:
cd /path/to/repo
git rm --cached dist
echo dist/>>.gitignore
git add .gitignore
git commit -m "Delete and ignore dist/"
git push
What happens if I add a node module( like if I decide to add an image cropper). How can the other contributers deal with that?
您需要在项目中添加该模块的声明,而不是对模块本身进行版本控制。例如,using Vue.use
.
Also: I host the app on netlify. It builds the site straight from github. But it wont be able to build the site if gihub doesnt have the dist folder...
参见“How to deploy your Vue app with Netlify in less than 2 min!" from Jean-Philippe Fong:Netlify 本身将构建 dist
(来自您的 GitHub 项目 sources)并发布它。
您应该将 .gitignore 文件添加到您可以忽略文件和目录的目录的根目录中。
最典型的忽略如下:
node_modules
/dist
.env
.vscode
我试过 uploading my files to Github,但是 GitHub 说它太大了。
然后我在构建生产后上传了 dist
文件夹的内容。
这工作得很好,但不是很有用。
将 Vue.js 应用程序上传到 GitHub 的正确方法是什么?
您生成的(可能很大的二进制文件)不应该versioned/pushed到GitHub。
最好使用本地插件,它会在 GitHub 端构建、标记和发布与您的项目关联的版本。
您可以将其与 GitHub 操作结合使用,它可以获取该版本,并将其部署到您选择的远程服务器上(前提是可以从 GitHub 公开访问):参见例如“How to deploy your VueJS using Github Actions (on Firebase Hosting)" from John Kilonzi.
对于您现有的 dist,您应该删除它(仅从 Git,而不是您的磁盘)并将其添加到您的 .gitignore:
cd /path/to/repo
git rm --cached dist
echo dist/>>.gitignore
git add .gitignore
git commit -m "Delete and ignore dist/"
git push
What happens if I add a node module( like if I decide to add an image cropper). How can the other contributers deal with that?
您需要在项目中添加该模块的声明,而不是对模块本身进行版本控制。例如,using Vue.use
.
Also: I host the app on netlify. It builds the site straight from github. But it wont be able to build the site if gihub doesnt have the dist folder...
参见“How to deploy your Vue app with Netlify in less than 2 min!" from Jean-Philippe Fong:Netlify 本身将构建 dist
(来自您的 GitHub 项目 sources)并发布它。
您应该将 .gitignore 文件添加到您可以忽略文件和目录的目录的根目录中。
最典型的忽略如下:
node_modules
/dist
.env
.vscode