npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-plugin-browsersync-gen2

v1.1.7

Published

A fork of original Cordova Plugin to integrate browser-sync in the workflow

Downloads

1,178

Readme

Cordova Browser-Sync Plugin - 24-11-2019

This is a fork of original Cordova Browser-Sync Plugin 1.1.0, developed by nparashuram. The purpose of this fork is to become compatible with latest version of Apache Cordova.

Integrating BrowserSync into your Cordova workflow.

  • Watch files in the www folder and automatically reload HTML and CSS in all connected devices
  • Use BrowserSync's dashboard to control devices and reload them.
  • Synchronize scrolls, clicks and form inputs across multiple devices.
  • Supports real devices and emulators for iOS and Android platforms

Usage - Installation

This is now done automatically but if your browser does still not refresh, try adding the script-src 'self' 'unsafe-inline'; section inside CSP meta tag (<meta content=...>) in index.html file. This is really important for browser-sync to refresh browsers.

Note that a --live-reload parameter is required to include in cordova run command.

The presence of this --live-reload flag triggers the live reload workflow. Without this flag, the project remains unchanged. This way, the plugin does not have to be removed before packaging it for final deployment.

Install as a Cordova plugin (easiest)

The simplest way to integrate this in your Cordova workflow is to add it as a plugin

cordova plugin add cordova-plugin-browsersync-gen2

or

cordova plugin add https://github.com/DimitrisRK/cordova-plugin-browsersync-gen2.git

and then run the cordova command with --live-reload. Samples:

cordova run browser --live-reload
cordova run android --live-reload
cordova run ios --live-reload
cordova run --live-reload (will run project using all platforms)

NEW

From now on, plugin supports --live-reload with cordova serve command.

cordova serve --live-reload

In that case, default static page server will never run and that's how it should be.

*Note: Setting port using Cordova docs format cordova server [port] will not work. However, you can try setting port using the browser-sync parameter example mentioned below.

Options

In general, plugin supports most of browser-sync parameters (if not all) in --parameter or --parameter=value formats (no need for quotes).

Ignoring files

In many cases other hooks may copy over JS, CSS or image assets into folders like www\lib, typically from locations like bower_components. These hooks may run at after_prepare and hence should be ignored in the live reload workflow. To achieve this, run the command as

cordova run --live-reload --ignore=lib/**/*.*

The --ignore commands takes an anymatch compatible destination relative to the www folder.

Setting custom hostname

Sometimes, depending on your network, your OS will report multiple external IP addresses. If this happens, by default browsersync just picks the first one and hopes for the best.

To override this behaviour and manually select which host you want to use for the external interface, use the --host option, for example:

cordova run --live-reload --host=192.168.1.1

Setting custom port

If you need to forward ports from your local computer to the device because the device is not in the same network as your device then you may getting an error or red circle. If this happens the problem could be the 3000 port. Then you can try another one for example 8090 which should work then.

cordova run --live-reload --port=8090

Setting custom index file

If you do not have "index.html" in your config.xml under content node then you need to set this option to the value. Please use the --index option.

cordova run --live-reload --index=content.html

Enable https

If you need https you can enable it with this option. You can use --https for example.

cordova run --live-reload --https