本站已搬家!

本站已搬家至https://blog.typeart.cc


歡迎舊雨新知指教!

vue init 離線初始化

大部份情況下,安裝完vue cli後,直接下vue init webpack project-name就可以開始初始化一個範本並準備開始開發。
但某些情況下可能需要用到離線初始化

1. 下載模版

首先,先到github/vuejs-template下載所需模版
若是要開發electron-vue,則到github/SimulatedGREG/electron-vue,按download整包下載

2. 解壓縮至指定路徑

把檔案解解壓縮出來後的資料夾,放至
C:\Users\{你的使用者名字}.vue-templates
若系統是WIN 10,會遇到一個問題:
按右鍵>新建資料夾後,輸入.vue-templates,會彈出對話視窗叫你輸入檔名


所以只能使用cmd建立
win鍵 + R 開啟執行視窗> 輸入 cmd
win預設的目錄就會是在C:\Users\\{你的使用者名字}
所以直接下指令:
mkdir .vue-templates
就會建立起.vue-templates資料夾
在把解壓縮出來的資料夾放入此目錄

3. 執行離線初始化

到project資料夾
執行
vue init webpack my-project --offline
//下方以手動下載的electron-vue為例
vue init electron-vue-master my-project --offline
注意!init後面接的名字,要以你放在.vue-templates底下的資料夾名字為主!而不是github上寫的vue init simulatedgreg/electron-vue my-project唷!

留言