Javascript 如何使用浏览器同步将iframe内容上的忽略路径列入黑名单

Javascript 如何使用浏览器同步将iframe内容上的忽略路径列入黑名单,javascript,node.js,xhtml,browser-sync,Javascript,Node.js,Xhtml,Browser Sync,我正在使用浏览器同步为一个站点开发ui,浏览器同步代码片段被注入到页面上的iframe中,它引用了来自epub 3.0的xhtml文件。 这会产生一个错误,因为您不能在xhtml上使用document.write(),这是浏览器同步将其脚本注入页面的方式 我试过使用 var sync = require('browser-sync'); sync({ server: { baseDir: [ '.', 'bower_com

我正在使用浏览器同步为一个站点开发ui,浏览器同步代码片段被注入到页面上的iframe中,它引用了来自epub 3.0的xhtml文件。 这会产生一个错误,因为您不能在xhtml上使用document.write(),这是浏览器同步将其脚本注入页面的方式

我试过使用

var sync = require('browser-sync');

sync({
    server: {
        baseDir: [
            '.',
            'bower_components' //- Because i'm making a polymer element, so when bower installed, ../path leads into bower_components
        ]
    },
    snippetOptions: { //- I've tried each of the following by themselves also
        blacklist: ['path/to/iframe/file.xhtml'], 
        whitelist: ['index.html'],
        ignorePaths: ['path/to/iframe/file.xhtml']
    }
});
但它仍然将片段注入iframe

我也尝试过不在代码段模式下使用浏览器同步(不在配置中设置代理或服务器),但当我手动将代码段脚本放入index.html时,它不会重新加载index.html上的页面

sync({
    serveStatic: ['.', 'bower_components']
});
在index.html的末尾有以下内容,这是我希望browser sync插入的唯一文件。 //http://HOST:3000/browser-sync/browser sync client.2.9.3.js'>”。替换(“主机”,location.hostname));//]>

我确保HOST:PORT与浏览器同步使用的端口匹配

下面是这里的文档