Socket
Socket
Sign inDemoInstall

browser-sync

Package Overview
Dependencies
Maintainers
1
Versions
300
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browser-sync

Live CSS Reload & Browser Syncing


Version published
Weekly downloads
683K
decreased by-3.11%
Maintainers
1
Weekly downloads
 
Created

What is browser-sync?

Browser-sync is a powerful tool for web developers that provides live reloading, synchronized browser testing, and other features to streamline the development process. It helps in creating a seamless development experience by automatically refreshing the browser whenever files are changed, and it can also synchronize interactions across multiple devices.

What are browser-sync's main functionalities?

Live Reloading

This feature allows the browser to automatically reload whenever files in the specified directory are changed. The code sample sets up a server to serve files from the 'app' directory and watches for changes in any files within that directory, triggering a reload when changes are detected.

const browserSync = require('browser-sync').create();
browserSync.init({
  server: './app'
});
browserSync.watch('app/**/*.*').on('change', browserSync.reload);

Synchronized Browsing

Synchronized browsing ensures that interactions like clicks and scrolls are mirrored across all connected devices. The code sample initializes Browser-sync with ghost mode enabled for clicks and scrolls, allowing these interactions to be synchronized.

const browserSync = require('browser-sync').create();
browserSync.init({
  server: './app',
  ghostMode: {
    clicks: true,
    scroll: true
  }
});

Proxying an Existing Server

This feature allows Browser-sync to act as a proxy for an existing server, enabling live reloading and synchronized browsing without changing the server configuration. The code sample sets up Browser-sync to proxy requests to 'yourlocal.dev'.

const browserSync = require('browser-sync').create();
browserSync.init({
  proxy: 'yourlocal.dev'
});

Other packages similar to browser-sync

Keywords

FAQs

Package last updated on 17 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc