Merge pull request #380 from responsively-org/bugfix/browser-sync

Bugfix/browser sync
This commit is contained in:
Manoj Vivek 2020-08-05 23:13:07 +05:30 committed by GitHub
commit 557ee48635
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 10 deletions

View file

@ -1 +1,2 @@
export const BROWSER_SYNC_VERSION = '2.26.7';
export const BROWSER_SYNC_PORT = '12719';

View file

@ -264,6 +264,14 @@ const createWindow = async () => {
icon: iconPath,
});
await initBrowserSync();
ipcMain.handle('request-browser-sync', (event, data) => {
const browserSyncOptions = {
url: getBrowserSyncEmbedScriptURL(),
};
return browserSyncOptions;
});
mainWindow.loadURL(`file://${__dirname}/app.html`);
mainWindow.webContents.on('did-finish-load', () => {
@ -283,8 +291,6 @@ const createWindow = async () => {
}
});
await initBrowserSync();
initMainShortcutManager();
const onResize = () => {
@ -410,13 +416,6 @@ const createWindow = async () => {
}
});
ipcMain.handle('request-browser-sync', (event, data) => {
const browserSyncOptions = {
url: getBrowserSyncEmbedScriptURL(),
};
return browserSyncOptions;
});
ipcMain.on('open-devtools', (event, ...args) => {
const {webViewId, bounds, mode} = args[0];
if (!webViewId) {

View file

@ -1,6 +1,9 @@
const browserSyncEmbed = require('browser-sync').create('embed');
import {BROWSER_SYNC_VERSION} from '../constants/browserSync';
import {
BROWSER_SYNC_VERSION,
BROWSER_SYNC_PORT,
} from '../constants/browserSync';
import fs from 'fs';
let filesWatcher;
@ -55,6 +58,7 @@ async function initInstance(): Promise<> {
https: true,
notify: false,
ui: false,
port: BROWSER_SYNC_PORT,
},
(err, bs) => {
if (err) {