Posts

Showing posts with the label Browser Sync

BrowserSync Cannot GET /

Answer : Using BrowserSync as a server only works if you're running a static site, so PHP won't work here. Looks like you're using XAMPP to serve your site, you can use BrowserSync to proxy your localhost. Example: browser-sync start --proxy localhost/yoursite References: http://www.browsersync.io/docs/command-line/#proxy-example https://github.com/BrowserSync/browser-sync/issues/5 Because it works only with index.html by default, for example: linux@linux-desktop:~/Templates/browsersync-project$ ls brow.html css linux@linux-desktop:~/Templates/browsersync-project$ browser-sync start --server --files '.' Expected result: Cannot GET/ In order to see your static web-page in the web-browser instead of that annoying message you have to rename a file brow.html to index.html . This will solve Cannot GET/ problem. P.S. Where you are installing a browser-sync doesn’t matter. Just type npm install -g browser-sync whatever directory you are in...

Can't Change The Base Folder For Lite-server In Angular 2 Application

Answer : You should use a file called bs-config.js (instead of a bs-config.json one) since lite-server tries to load a module using the require function. The configuration should be a valid Node module: module.exports = { "port": 8123, "server": { "baseDir": "./src" } }; See this line in the source code: https://github.com/johnpapa/lite-server/blob/master/lib/lite-server.js#L20. This file by default is loaded from the user's project folder. Edit After digging a bit more, the first part of my answer relies on the code from github but not the one actually installed using npm install (version 1.3.4) There are two options in this case: port baseDir Using this command will fix your problem: $ lite-server --baseDir ./src --port 3333 Hope it helps you, Thierry The answer from Thierry Templier is not quite correct (anymore), you can use either the bs-config.json or bs-config.js configuration to adjust your browse...