浏览器同步不断重新加载

时间:2017-12-11 05:26:11

标签: javascript browser-sync

我正在使用JS,HTML,CSS创建项目,我正在尝试使我的工作流程更快更容易,因此我决定安装浏览器同步以帮助在编码过程中自动重新加载页面。这将是一个很好的解决方案,但浏览器同步后不断重新加载我的页面30-60秒,这是令人讨厌的,因为在调试期间我改变谷歌Chrome开发工具,如CSS属性,浏览器重新加载和更改的东西。这就是我开始浏览器同步的方式

browser-sync start --server --files . 

这是我的bs-config.js

module.exports = {
"ui": {
    "port": 3001,
    "weinre": {
        "port": 8080
    }
},
"files": ["./css/*.css", "./scripts/*.js", "./*.html"],
"watchEvents": [
    "change"
],
"watchOptions": {
    "ignoreInitial": false
},
"server": false,
"proxy": false,
"port": 3000,
"middleware": false,
"serveStatic": [],
"ghostMode": {
    "clicks": true,
    "scroll": true,
    "location": true,
    "forms": {
        "submit": true,
        "inputs": true,
        "toggles": true
    }
},
"logLevel": "info",
"logPrefix": "Browsersync",
"logConnections": false,
"logFileChanges": true,
"logSnippet": true,
"rewriteRules": [],
"open": "local",
"browser": "default",
"cors": false,
"xip": false,
"hostnameSuffix": false,
"reloadOnRestart": false,
"notify": true,
"scrollProportionally": true,
"scrollThrottle": 0,
"scrollRestoreTechnique": "window.name",
"scrollElements": [],
"scrollElementMapping": [],
"reloadDelay": 0,
"reloadDebounce": 0,
"reloadThrottle": 0,
"plugins": [],
"injectChanges": true,
"startPath": null,
"minify": true,
"host": null,
"localOnly": false,
"codeSync": true,
"timestamps": true,
"clientEvents": [
    "scroll",
    "scroll:element",
    "input:text",
    "input:toggles",
    "form:submit",
    "form:reset",
    "click"
],
"socket": {
    "socketIoOptions": {
        "log": false
    },
    "socketIoClientConfig": {
        "reconnectionAttempts": 50
    },
    "path": "/browser-sync/socket.io",
    "clientPath": "/browser-sync",
    "namespace": "/browser-sync",
    "clients": {
        "heartbeatTimeout": 5000
    }
},
"tagNames": {
    "less": "link",
    "scss": "link",
    "css": "link",
    "jpg": "img",
    "jpeg": "img",
    "png": "img",
    "svg": "img",
    "gif": "img",
    "js": "script"
}

};

我没有添加任何配置。我试图找到解决方案,但没有任何帮助。

我想要的是仅在我制作并保存对.htm,.css,.js文件的更改时重新加载页面,我认为这是浏览器同步的默认行为。

0 个答案:

没有答案