browser-sync README

The project's README from github.com/BrowserSync/browser-sync. As one markdown file: README.md.

Keep multiple browsers & devices in sync when building websites.

Follow @Browsersync on twitter for news & updates.

Ask questions on Discord

Features

Please visit browsersync.io for a full run-down of features

Requirements

Browsersync works by injecting an asynchronous script tag (<script async>...</script>) right after the <body> tag during initial request. In order for this to work properly the <body> tag must be present. Alternatively you can provide a custom rule for the snippet using snippetOptions

Upgrading from 1.x to 2.x ?

Providing you haven't accessed any internal properties, everything will just work as there are no breaking changes to the public API. Internally however, we now use an immutable data structure for storing/retrieving options. So whereas before you could access urls like this...

browserSync({server: true}, function(err, bs) {
  console.log(bs.options.urls.local);
});

... you now access them in the following way:

browserSync({server: true}, function(err, bs) {
  console.log(bs.options.getIn(["urls", "local"]));
});

Install and trouble shooting

browsersync.io docs

Integrations / recipes

Browsersync recipes

Support

If you've found Browser-sync useful and would like to contribute to its continued development & support, please feel free to send a donation of any size - it would be greatly appreciated!

Support via PayPal

Supported by

Originally supported by JH - they provided financial support as well as access to a professional designer to help with Branding.

Apache 2 Copyright (c) 2021 Shane Osbourne

browser-sync (BrowserSync/browser-sync)

Searching Database…

这是干什么的?BrowserSync 是一款开发者工具,在你搭建网站时让多个浏览器和设备保持同步——你在一个浏览器里的操作会实时同步到其他浏览器。
它是开发时运行的工具,还是我写代码时用的库?两种都有:它以 npm 包的形式提供命令行工具,同时也提供公开的 API,供其他代码和集成方案在其基础上开发。
怎么在我电脑上把它跑起来?先安装这个 npm 包(npm install -g browser-sync),然后按照 browsersync.io 上的安装和故障排查指南入门即可。
需要先装 Node.js 或其他东西吗?需要——它是通过 npm 分发的 JavaScript 包,所以电脑上必须装有 Node.js 和 npm;安装时还会一并下载它的运行时依赖,比如 rxjs。
我用的是 1.x,升级到 2.x 会不会出问题?不会,只要你没有访问过内部属性就行:公开的 API 没有任何破坏性改动。只有内部选项的存储方式变了,所以 urls 的读取方式有所不同。
BrowserSync 是怎么注入到我的页面里的?它通过页面中的一个 snippet 标签来工作——这个标签必须存在,同步才能生效;如有需要,你可以通过 snippetOptions 为这个标签提供自定义规则。
有没有现成的和构建工具集成的例子?有——README 里链接到了 'Browsersync recipes',这是一套针对常见环境的现成集成示例。
它是免费的吗?开发靠什么维持?它是免费的,基于 Apache 2.0 许可证发布。作者接受任意金额的 PayPal 捐赠,以支持项目的持续开发。
Size
14.5 MB
Stars
12.3K
Age
13y
Commits · 90 Days