如何更改 vue 默认项目信息模板?
How to change vue default project info template?
我是 vue.js 和 vuetify.js 的新手。当我使用命令
vue init webpack app
vue会给出一些默认的项目设置,比如项目名称,作者,..
问题是,默认设置从哪里来?如何更改为我自定义的默认设置,以便更快地创建更多项目?
您可以通过以下方式使用自己的模板:
vue init username/repo my-project-name
Custom Templates
It's unlikely to make everyone happy with the official templates. You
can simply fork an official template and then use it via vue-cli
with:
vue init username/repo my-project
Where username/repo
is the GitHub repo shorthand for your fork.
The shorthand repo notation is passed to
download-git-repo so
you can also use things like bitbucket:username/repo
for a Bitbucket
repo and username/repo#branch
for tags or branches.
If you would like to download from a private repository use the
--clone
flag and the cli will use git clone
so your SSH keys are
used.
Local Templates
Instead of a GitHub repo, you can also use a template on your local
file system:
vue init ~/fs/path/to-custom-template my-project
分步示例:
分叉https://github.com/vuejs-templates/webpack
- 示例:https://github.com/acdcjunior/webpack-vue-template(除了 fork,我还重命名了 repo)
重要提示:确保您在 master
分支 并提交。
- 例如,要更改项目描述,edit the
meta.js
file.
- commit here.
的例子
现在使用vue init
示例:
vue init acdcjunior/webpack-vue-template my-project-from-my-template
这对Vue-cli v2.x有效。
我是 vue.js 和 vuetify.js 的新手。当我使用命令
vue init webpack app
vue会给出一些默认的项目设置,比如项目名称,作者,.. 问题是,默认设置从哪里来?如何更改为我自定义的默认设置,以便更快地创建更多项目?
您可以通过以下方式使用自己的模板:
vue init username/repo my-project-name
Custom Templates
It's unlikely to make everyone happy with the official templates. You can simply fork an official template and then use it via
vue-cli
with:vue init username/repo my-project
Where
username/repo
is the GitHub repo shorthand for your fork.The shorthand repo notation is passed to download-git-repo so you can also use things like
bitbucket:username/repo
for a Bitbucket repo andusername/repo#branch
for tags or branches.If you would like to download from a private repository use the
--clone
flag and the cli will usegit clone
so your SSH keys are used.Local Templates
Instead of a GitHub repo, you can also use a template on your local file system:
vue init ~/fs/path/to-custom-template my-project
分步示例:
分叉https://github.com/vuejs-templates/webpack
- 示例:https://github.com/acdcjunior/webpack-vue-template(除了 fork,我还重命名了 repo)
重要提示:确保您在
master
分支 并提交。- 例如,要更改项目描述,edit the
meta.js
file. - commit here. 的例子
- 例如,要更改项目描述,edit the
现在使用
vue init
示例:
vue init acdcjunior/webpack-vue-template my-project-from-my-template
这对Vue-cli v2.x有效。