How to change default file watch options in LiteServer

1.6k views Asked by At

So I'm trying to use LiteServer in my project, but I can't get it to change the default watch of index.html, my current file is index1.html. I specified app2.js as the entry point during npm init, so I was able to change the JS default, but not for HTML.

> 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

I know the doc mentions the use of a bs-config.json file, but I couldn't get any reference which has the syntax for this.

Would appreciate the help!


UPDATE - I currently have this in the bs-config.json file, but no use -

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

There are 1 answers

0
Beans On

lite-server is based on BrowserSync. bs-config.js is browsersync's config file. The config options are documented here: https://browsersync.io/docs/options

For example, to set your default indx to be index1.html, instead of setting it in your routes, the bs-config.json could contain:

{
  "server": {
    "baseDir": "src",
    "index": "/index1.html",
    "routes": {
      "/node_modules": "node_modules"
    }
  }
}