Skip to content

Instantly share code, notes, and snippets.

@averyfreeman
Created September 8, 2021 11:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save averyfreeman/ae4d1f05a66943b16d2e1fe8c8e807e4 to your computer and use it in GitHub Desktop.
Save averyfreeman/ae4d1f05a66943b16d2e1fe8c8e807e4 to your computer and use it in GitHub Desktop.
browser-sync bs-config.js that will end the document.write errors in devTools
'use strict';
// var fallback = require('connect-history-api-fallback');
// var log = require('connect-logger');
/*
| For up-to-date information about the options:
| http://www.browsersync.io/docs/options/
*/
module.exports = {
port: 8085,
injectChanges: true,
watchOptions: {
ignored: ['node_modules', '.git'],
},
snippetOptions: {
rule: {
match: /<\/head>/u,
fn(snippet, match) {
const {
groups: { src },
} = /src='(?<src>[^']+)'/u.exec(snippet);
return `<script src="${src}" async></script>${match}`;
},
},
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment