Open abelAbel opened 7 years ago
Host OS: Ubuntu 18.04 Gulp: CLI version 2.0.1, Local version 4.0.0 Browsersync: 2.26.3
I had the same issue using Gulp and Browsersync with proxy statement and had to change the file strings from single to double quotes in order for the browser to reload after changing a root folder *.php files.
var // Load Gulp apps gulp = require('gulp'), browserSync = require('browser-sync').create(), scss = require('gulp-sass'), sourcemaps = require('gulp-sourcemaps'), postcss = require('gulp-postcss'), changed = require('gulp-changed'), autoprefixer = require('autoprefixer'),
//Files
scssFiles = "src/scss/*.scss",
cssFiles = "css/*.css",
phpFiles = "*.php",
htmlFiles = "*.html";
gulp.task('watch', gulp.series(function (done) {
browserSync.init({
proxy: 'localhost/wordpress',
//If these files change inject css or refresh as necessary
files: [cssFiles,
phpFiles,
jsFiles,
htmlFiles
],
});
gulp.watch(scssFiles,gulp.series('scss'));
done();
}));
gulp.task('scss', function(done) { return gulp.src([scssFiles]) .pipe(sourcemaps.init()) .pipe(changed('css')) .pipe(scss().on('error', scss.logError)) .pipe(postcss([ autoprefixer() ])) //.pipe(cssnano()) .pipe(sourcemap //notify: false, //Don't show any notifications in the browser //open: false, //Don't open new browser windows.write('.')) .pipe(gulp.dest('css')); //.pipe(browserSync.stream()); //taken care of by BS Files option done(); });
gulp.task('runonce', function (done) { // One-off changes... gulp.src('node_modules/font-awesome/css/font-awesome.min.') .pipe(changed('css')) .pipe(gulp.dest('css')); gulp.src('node_modules/font-awesome/fonts/') .pipe(changed('fonts')) .pipe(gulp.dest('fonts')); gulp.src('node_modules/jquery/dist/jquery.slim.min.') .pipe(changed('js')) .pipe(gulp.dest('js')); gulp.src('node_modules/popper.js/dist/umd/popper.min.') .pipe(changed('js')) .pipe(gulp.dest('js')); gulp.src('node_modules/bootstrap/dist/js/bootstrap.min.*') .pipe(changed('js')) .pipe(gulp.dest('js')); done(); });
gulp.task('default', gulp.series( ['runonce','scss', 'watch']) , function (done) {
done();
});
Issue details
Please provide issue details here. On the document page (https://www.browsersync.io/docs/command-line#start) it showed to use single quotes, but when I tried using a single quote on window command line (
>browser-sync start --proxy 'localhost:80' --files '*'
), I was getting error code 403, and the URL I got was "http://localhost:3000/%27localhost:80%27". When I changed to double quotes (>browser-sync start --proxy "localhost:80" --files "*"
), it was working and I got the proper URL "http://localhost:3000/index.php". I just want to report on this, to save others some headaches. On the other hand single quote worked when I wasn't proxying, e.g.>browser-sync start --server --files='*.html'
. Again I was to proxy an existing XAMPP server with browser-sync and tried following the browser-sync documentation which suggested to do this$ browser-sync start --proxy 'mylocal.dev' --serveStatic 'public' --files 'public'
. Which in my case didn't work.Steps to reproduce/test case
Please provide necessary steps for reproduction of this issue, or better the reduced test case (without any external dependencies).
Please specify which version of Browsersync, node and npm you're running
Affected platforms
Browsersync use-case
If CLI, please paste the entire command below
{cli command here}
for all other use-cases, (gulp, grunt etc), please show us exactly how you're using Browsersync
{Browsersync init code here}