Browsersync服务于IP地址

时间:2015-09-16 22:28:58

标签: node.js browser-sync

我想以与localhost不同的IP地址为我的网站提供服务。我试图将我的hosts文件中的IP地址设置为我需要测试的URL。这与browserync有关吗?如果没有,还有其他选择吗?

1 个答案:

答案 0 :(得分:0)

这与browsery-sync没有直接关系。

在您的hosts文件中设置ip,然后在浏览器同步配置中代理它。

var bs     = require("browser-sync").create();
var client = require("./");

client["plugin:name"] = "client:script";

bs.use(client);

bs.init({
    //server: {
    //    baseDir: ["test/fixtures"]
    //},
    //proxy: 'http://localhost:8080',
    proxy: 'http://mylocal.com:8080',
    open: false,
    minify: false,
    snippetOptions: {
        rule: {
            //match: /SHNAE/,
            match: /<\/head>/i,
            fn: function (snippet) {
                return snippet + "\n</head>";
            }
        }
    },
    clientEvents: [
        "scroll",
        "input:text",
        "input:toggles",
        "input:keydown",
        "input:keypress",
        "form:submit",
        "form:reset",
        "click",
        "contenteditable:input",
        "mouseup",
        "mousedown",
        "select:change"
    ],
    ghostMode: {
        clicks: true,
        scroll: true,
        forms: {
            submit: true,
            inputs: true,
            toggles: true,
            keypress: true,
            keydown: true,
            contenteditable: true,
            change: true
        },
        mouseup: true,
        mousedown: true
    },
    capture:true
});