sigh-browser-sync
Sigh plugin for browser-sync.
Example
npm install --save-dev sigh-browser-sync browser-sync
then add something like this to your sigh.js
:
var browserSync glob write sass module { var globOpts = basePath: 'src' pipelines'build:source' = }
Now whenever the write
operation passes on written files, if they are css
files the browser-sync
server will update your page, if they are .js
files the page will reload.
An optional object can be passed as the first argument to browserSync
and will be passed on to the live-reload server's init
call, a list of supported arguments can be found here.
The client javascript will require code like this to connect to the live-reload
server (replacing 3000 with whichever port is being used):
var js = documentjssrc = '//' + locationhost || 'localhost'0 + ':3000/browser-sync/browser-sync-client.js'documentbody
TODO
- Write tests.
- Options for altering file paths, e.g. stripping/adding directories from/to path.