Skip to content

Instantly share code, notes, and snippets.

@yhuard
Created February 16, 2017 10:32
Show Gist options
  • Save yhuard/b3ab432a3296cdc35affc36adaac761c to your computer and use it in GitHub Desktop.
Save yhuard/b3ab432a3296cdc35affc36adaac761c to your computer and use it in GitHub Desktop.
Browsersync proxy example
{
"name": "browsersync-proxy-example",
"version": "1.0.0",
"description": "",
"main": "proxy.js",
"scripts": {
"start": "node ./proxy.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "MIT",
"devDependencies": {
"browser-sync": "^2.18.8"
}
}
const browserSync = require('browser-sync').create();
browserSync.init({
// URL of the website we want to proxy
proxy: 'https://webgate.acceptance.ec.europa.eu/multisite/farnet/',
// Serve files from local src folder
serveStatic: ['src'],
// If you want to inject custom files
snippetOptions: {
rule: {
match: /<\/head>/i,
fn: function(snippet, match) {
return '<link rel="stylesheet" type="text/css" href="/_custom.css"/>' + snippet + match;
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment