A
A
Aidos Amantaev2017-07-25 20:48:22
PHP
Aidos Amantaev, 2017-07-25 20:48:22

Browser-sync with php is it wrong?

Already exhausted. The second day I can not cope with these infernal tools. Help me please.
I want to make a website using php and have browser-sync work. Yes, the Internet is full of all sorts of posts about this, but there are preprocessors everywhere and all that. I would just like browser-sync to update a regular php page with regular css and js. Do not need anything else. I myself tried probably 20 times to write and rewrite what is said in these manuals, it did not work out. Please write who can gulpfile.js with a focus on the teapot itself of teapots. There is an open server, but there is a site in the root folder, without any app, etc.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Goryachev, 2017-07-25
@aaaaido

// include gulp
var gulp                = require('gulp');
var browserSync         = require('browser-sync').create();
var localhost           = 'site.loc'; // изменить на свой хост
// browser-sync task and settings
gulp.task('browserSync', function(){
    browserSync.init({
        open: 'external',
        host: localhost,
        proxy: localhost,
        port: 8080
    });
});
// start watchers
gulp.task('watch', ['browserSync'], function(){
    gulp.watch('**/*.*', browserSync.reload);
});

Actually, we put gulp and browserSync, then npm install.
Well, the whole thing starts through gulp watch.

S
Sergey Semenko, 2017-07-25
@abler98

https://fettblog.eu/php-browsersync-grunt-gulp/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question