yarn browser-sync 2.8.0

latest releases: 3.0.2, 3.0.1, 3.0.0...
8 years ago

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.

Don't miss a new browser-sync release

NewReleases is sending notifications on new releases.