Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
cordova-plugin-browsersync-gen2
Advanced tools
A fork of original Cordova Plugin to integrate browser-sync in the workflow
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.
www
folder and automatically reload HTML and CSS in all connected devicesThis 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 incordova 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.
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)
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.
In general, plugin supports most of browser-sync parameters (if not all) in --parameter or --parameter=value formats (no need for quotes).
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.
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
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
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
If you need https you can enable it with this option.
You can use --https
for example.
cordova run --live-reload --https
FAQs
A fork of original Cordova Plugin to integrate browser-sync in the workflow
The npm package cordova-plugin-browsersync-gen2 receives a total of 124 weekly downloads. As such, cordova-plugin-browsersync-gen2 popularity was classified as not popular.
We found that cordova-plugin-browsersync-gen2 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.