node.jsbrowser-synclite-server

Changing the default file to be loaded using lite-server


How can I change the configurations to load a custom file using lite-server "browserSync" like "about.html" instead of the default one "index.html"?


Solution

  • You need to use the startPath option and dictate your about.html file instead. The easiest way to do this is to create a bs-config.json file in the root of your project. This will be automatically read and override the defaults for Lite-Server when it is ran. Here is the only thing you would need inside of bs-config.json file:

    { "startPath": "about.html" }

    I have used this very configuration and it works successfully. Keep in mind that if about.html is not in the same directory as the configuration file, make sure you specify it's path properly.