Run browser-sync in php server

Viewed 1068

I have a XAMPP local PHP server and I need use browser sync but I don't know how to run it WITHOUT gulp or grunt only using command line. I try to

browser-sync start --server --port 80 --files "css/.css" 

but instead of port 80 it launch with 81 port

browser-sync start --proxy 'localhost:80' I tried this. It's connect to my localserver but doesn't refresh

1 Answers

You have an error in your --files argument. There should be an asterisk before .css to select all CSS files in your css directory, like this:

browser-sync start --proxy "localhost:80" --files "css/*.css"

Remember that the directory path should be relative to the current directory you're inside in your terminal/cmd window.

This means that if your server is running on localhost and CSS files can be found under localhost/css, it is NOT enough to just run the browsersync script above from any directory.

You have to navigate to your local server folder (usually C:\xampp\htdocs, where your real css folder is located) and run the browsersync script from there. Alternatively, if you don't want to change the directory in your console/terminal/cmd window, you have to specify the full relative path to your CSS files from your current directory.

Had the exact same issue, and I just had to run the script from the correct folder path.

Related