2016-12-22 48 views
0

所以我試圖在我的項目中使用LiteServer,但我無法得到它來更改默認手錶index.html,我當前的文件是index1.html。我指定app2.js作爲npm init期間的入口點,所以我能夠更改JS默認值,但不能用於HTML。如何更改LiteServer中的默認文件觀看選項

> lite-server 

Did not detect a `bs-config.json` or `bs-config.js` override file. Using lite-server defaults... 
** browser-sync config ** 
{ injectChanges: false, 
    files: [ './**/*.{html,htm,css,js}' ], 
    watchOptions: { ignored: 'node_modules' }, 
    server: { baseDir: './', middleware: [ [Function], [Function] ] } } 
[BS] Access URLs: 
-------------------------------------- 
     Local: http://localhost:3000 
    External: http://10.40.244.189:3000 
-------------------------------------- 
      UI: http://localhost:3001 
UI External: http://10.40.244.189:3001 
-------------------------------------- 
[BS] Serving files from: ./ 
[BS] Watching files... 
16.12.21 18:43:32 200 GET /index.html 
16.12.21 18:43:32 200 GET /style.css 
16.12.21 18:43:33 200 GET /app2.js 
16.12.21 18:43:34 404 GET /favicon.ico 

我知道doc提到使用bs-config.json文件,但我不能讓這對於這個語法的任何引用。

將不勝感激的幫助!


更新 - 我現在有這樣的bs-config.json文件,但沒有用 -

{ 
    "files": ["style.css", "app2.js", "index1.html"] 
} 
+0

沒關係,我只是在路線中添加了'/ index1.html',並且它工作正常。 –

回答

0

精簡版服務器是基於BrowserSync。 bs-config.js是瀏覽器同步的配置文件。該配置選項被記錄在這裏: https://browsersync.io/docs/options

例如,要設置默認INDX是index1.html,而不是你的路由設置它的BS-config.json可以包含:

{ 
    "server": { 
    "baseDir": "src", 
    "index": "/index1.html", 
    "routes": { 
     "/node_modules": "node_modules" 
    } 
    } 
} 
相關問題