Skip to content

2.8.0

Compare
Choose a tag to compare
@shakyShane shakyShane released this 19 Jul 20:41
· 714 commits to master since this release

This is a minor release with 2 additional options.

  • Added proxy.proxyRes option to allow modifications to the response after the server has sent it. This is useful in situations where, for example, you'd want to overwrite headers before they hit the browser - like in this example - thanks to @lookfirst.
  • Added serveStatic option. We already include the serve-static library and some recent use-cases have shown a valid use-case for both the proxy + a static file server (think loading local assets into a live/staging website - way cool). So now you can do something like the following;
var bs = require('./').create();

bs.init({
    proxy: 'http://www.bbc.co.uk',
    files: ["**/*.css"],
    serveStatic: ["./css"],
    rewriteRules: [
        {
            match: "http://www.bbc.co.uk/some/css/styles.css",
            replace: "/css/styles.css"
        }
    ]
});

The file paths in that example are fictional, but serve to highlight how you could, with a combination of Browsersync options, proxy a live website, replace a link to point to a locally served css file, watch that file for changes & inject it whenever it does.