Answer the question
In order to leave comments, you need to log in
Guys what and how does it work with visual code files?
Hello! Guys what and how does it work with visual code files? The crux of the problem! There is a header.pug file, I write the code in it then CTRL + S , the tasks in gulp work out as expected, the code in index.php is updated and browser-sync updates the page in the browser, but the page is displayed without changes, so that the changes appear on the page, I you need to explicitly open the index.php file and do CTRL + S, after which browser-sync refreshes the page in the browser, the page with the changes made in the code is displayed. I thought that these were some peculiarities of the buffer operation in visual code (for example, as in Emacs), so I opened the index.php file in another editor and there it was with the actual changes in the code. Who has any thoughts on this?
I am attaching gulp files.
server.js
'use strict'
// этот модуль создает php прокси сервер для обработки php кода
const phpserver = require('gulp-connect-php');
const bs = require('browser-sync').get('Animxyz');
let serverPhp = new phpserver();
module.exports = function server(){
serverPhp.server({base: '../src', keepalive:true, hostname: '127.0.0.1', port:8100, open: false}, function(){
bs.init({
proxy: '127.0.0.1:8100',
});
})
}
const bs = require('browser-sync').create('Animxyz');
module.exports = function bs_all (){
bs.init({
server: {
// localhost: '127.0.0.1',
proxy: '127.0.0.1:8100',
baseDir: "../src"
},
callbacks: {
ready: function (err, bs) {
bs.addMiddleware("*", function (req, res) {
res.writeHead(302, {
location: "404.html"
});
res.end("Redirecting!");
});
}
},
browser: 'chrome',
logPrefix: 'BS-HTML:',
logLevel: 'info',
logConnections: true,
logFileChanges: true,
open: false,
notify: false
});
}
const {parallel, watch, src, dest} = require('gulp');
const rename = require("gulp-rename");
const pug = require('gulp-pug');
const bs = require('browser-sync').create('Animxyz');
const plumber = require('gulp-plumber');
const requireDir = require('require-dir');
const tasks = requireDir('./modulesTasks');
function funcpug(){
return src('../src/pug-sass/*.pug')
.pipe(plumber())
.pipe(pug({
// Your options in here.
pretty : true
}))
.pipe(rename({
extname: '.php'
}))
.pipe(plumber.stop())
.pipe(dest('../src/'))
}
exports.bs = tasks.bs;
exports.server = tasks.server;
exports.watching = tasks.watching;
exports.funcpug = funcpug;
exports.default = parallel(
exports.bs,
exports.server,
exports.watching)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question