1

I'm using the lite-server to develop an Angular application. I have the following project structure, very simple:

build/
    foo/
        index.html (references foo.js script)
    bar/
        index.html (references bar.js script)
foo.js
bar.js
bsconfig.json

What a I want to do is to access localhost:8000/foo and get foo/index.html loading foo.js script as well as access localhost:8000/bar and get bar/index.html loading bar.js.

I've read the Browsersync options documentation and tried configuring the bs-config.json file using routes but I couldn't get it working.

Bernardo Pacheco
  • 1,445
  • 1
  • 14
  • 23

2 Answers2

0

You may add routes to the server object

routes : {"/foo" : "build/foo", "/bar" : "build/bar" }

You may put your foo.js and bar.js under the "foo" and "bar" folders respectively and reference them locally, or leave the on the project's folder and reference it as "/foo.js" and "/bar.js"

Ran
  • 747
  • 6
  • 8
-1

you may set base href to point to different folders in the index.html files ,

  <base href="/foo/">

  <base href="/bar/">

Also you have to configure where you are serving main package from in system.config file.

Madhu Ranjan
  • 17,334
  • 7
  • 60
  • 69