Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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 - npm Package Compare versions

Comparing version 0.7.7 to 0.8.0

LICENSE-GPL

27

example.js

@@ -12,17 +12,13 @@

},
ghostMode: {
location: true
},
open: true,
logConnections: false,
notify: {
styles: [
"background-color: red",
"color: white",
"padding: 10px",
"display: none",
"font-family: sans-serif",
"position: absolute",
"z-index: 9999",
"right: 0px",
"border-bottom-left-radius: 5px"
]
}
minify: true,
debounce: 2000,
ports: {
min: 2000
},
notify: false
};

@@ -37,4 +33,5 @@

var bs = browserSync.init(files, options, function (err, bs) {
console.timeEnd("init");
return true;
// setTimeout(function () {
// browserSync.reload();
// }, 3000);
});

@@ -1,4 +0,6 @@

var gulp = require('gulp');
var jshint = require('gulp-jshint');
var contribs = require('gulp-contribs');
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var contribs = require('gulp-contribs');
var sass = require('gulp-sass');
var browserSync = require('./lib/index');

@@ -19,1 +21,39 @@ gulp.task('lint', function () {

gulp.task('default', ['lint']);
// Example code below
var paths = {
scss: "test/fixtures/scss/*.scss",
css: "test/fixtures/css",
html: "test/fixtures/*.html"
};
gulp.task('sass', function () {
gulp.src(paths.scss)
.pipe(sass({includePaths: ['scss']}))
.pipe(gulp.dest(paths.css))
.pipe(browserSync.reload({stream:true}));
});
gulp.task('browser-sync', function () {
var clientScript = require("/Users/shakyshane/Sites/browser-sync-modules/browser-sync-client/index");
browserSync.use("client:script", clientScript.middleware, function (err) {
console.log(err);
});
browserSync.init(null, {
proxy: "cb.dev"
});
});
gulp.task('bs-reload', function () {
browserSync.reload();
});
gulp.task('watch', ['browser-sync'], function () {
gulp.watch(paths.scss, ['sass']);
gulp.watch(paths.html, ['bs-reload']);
});

@@ -38,5 +38,3 @@ "use strict";

"input:text",
"input:select",
"input:radio",
"input:checkbox",
"input:toggles",
"form:submit",

@@ -146,3 +144,6 @@ "form:reset",

"file:reload": function (data) {
this.io.sockets.emit("reload", data);
this.io.sockets.emit("file:reload", data);
},
"browser:reload": function () {
this.io.sockets.emit("browser:reload");
}

@@ -149,0 +150,0 @@ };

@@ -7,7 +7,9 @@ module.exports = {

host: null,
codeSync: true,
ghostMode: {
clicks: true,
links: true,
links: false,
forms: true,
scroll: true
scroll: true,
location: false
},

@@ -25,3 +27,3 @@ server: false,

devMode: false,
fileTimeout: 1000,
debounce: 0,
scrollProportionally: true,

@@ -28,0 +30,0 @@ scrollThrottle: 0,

@@ -5,2 +5,3 @@ "use strict";

var Gaze = require("gaze").Gaze;
var _ = require("lodash");

@@ -64,4 +65,6 @@ /**

return function (filepath) {
var debounce = options.debounce;
var callback = function (filepath) {
var chunks = [];

@@ -85,2 +88,8 @@

};
if (debounce && debounce > 0) {
return _.debounce(callback, debounce);
} else {
return callback;
}
};

@@ -25,6 +25,5 @@ #! /usr/bin/env node

*/
function start(files, config, cb) {
module.exports.start = function (files, config, cb) {
return browserSync.init(files || [], config, pjson.version, cb);
}
module.exports.start = start;
};

@@ -40,3 +39,3 @@ /**

if (data.config) {
start(data.files, data.config);
exports.start(data.files, data.config);
}

@@ -50,2 +49,61 @@ if (data.configFile) {

/**
* Exposed helper method for triggering reload
* @param [arg]
* @returns {*}
*/
module.exports.reload = function (arg) {
function emitReload(path) {
browserSync.events.emit("file:changed", {
path: path
});
}
function emitBrowserReload() {
browserSync.events.emit("browser:reload");
}
if (typeof arg === "string") {
return emitReload(arg);
}
if (Array.isArray(arg)) {
return arg.forEach(emitReload);
}
if (arg && arg.stream === true) {
// Handle Streams here...
var emitted = false;
var once = arg.once || false;
var Transform = require("stream").Transform;
var reload = new Transform({objectMode:true});
reload._transform = function(file, encoding, next) {
if (once === true && !emitted) {
emitBrowserReload();
emitted = true;
this.push(file);
return next();
} else {
if (once === true && emitted) {
return;
}
if (file.path) {
emitted = true;
emitReload(file.path);
}
}
this.push(file);
next();
};
return reload;
}
return emitBrowserReload();
};
/**
* Handle External usage.

@@ -74,1 +132,3 @@ * @param {Array} [userFiles]

};
module.exports.emitter = browserSync.events;

@@ -127,3 +127,3 @@ "use strict";

if (res.statusCode === 302) {
res.headers.location = utils.handleRedirect(res.url, options, host, ports.proxy);
res.headers.location = utils.handleRedirect(res.headers.location, options.proxy, host, ports.proxy);
}

@@ -130,0 +130,0 @@ utils.removeHeaders(res.headers, ["content-length", "content-encoding"]);

@@ -72,3 +72,3 @@ "use strict";

if (!options || !options.ghostMode || !options.ghostMode.links) {
if (!options || !options.ghostMode || !options.ghostMode.location) {
return false;

@@ -130,3 +130,3 @@ }

* @param {socket} io
* @returns {{staticServer: (http.Server), proxyServer: (http.Server)}}
* @returns {{staticServer: (http.Server), proxyServer: (http.Server)}|Boolean}
*/

@@ -133,0 +133,0 @@ module.exports.launchServer = function (host, ports, options, io) {

@@ -60,3 +60,3 @@ "use strict";

* @param {Object} req
* @param {Array} excludeList
* @param {Array} [excludeList]
* @returns {Object}

@@ -63,0 +63,0 @@ */

{
"name": "browser-sync",
"description": "Live CSS Reload & Browser Syncing",
"version": "0.7.7",
"version": "0.8.0",
"homepage": "https://github.com/shakyshane/browser-sync",

@@ -44,3 +44,3 @@ "author": {

"resp-modifier": "0.0.4",
"browser-sync-client": "0.0.5",
"browser-sync-client": "0.1.4",
"commander": "~2.1.0",

@@ -60,3 +60,5 @@ "browser-sync-control-panel": "0.0.4"

"gulp-jshint": "~1.5.0",
"gulp-contribs": "0.0.1"
"gulp-contribs": "0.0.1",
"gulp-sass": "^0.7.1",
"vinyl": "^0.2.3"
},

@@ -63,0 +65,0 @@ "keywords": [

@@ -1,2 +0,2 @@

# browser-sync [![Build Status](https://travis-ci.org/shakyShane/browser-sync.png?branch=master)](https://travis-ci.org/shakyShane/browser-sync) [![NPM version](https://badge.fury.io/js/browser-sync.png)](http://badge.fury.io/js/browser-sync)
# browser-sync [![Build Status](https://travis-ci.org/shakyShane/browser-sync.png?branch=master)](https://travis-ci.org/shakyShane/browser-sync) [![NPM version](https://badge.fury.io/js/browser-sync.png)](http://badge.fury.io/js/browser-sync) [![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/)

@@ -36,19 +36,4 @@ > Keep multiple browsers & devices in sync when building websites.

##Screencasts ( < 3 min each )
1. [Using the Static Server with css injecting](http://quick.as/klaqfq7e)
2. [Keeping browsers at the same scroll position](http://quick.as/rl9gfgxd)
3. [Keeping form fields in sync](http://quick.as/zr9ofory)
4. [When should you use the built-in server?](http://quick.as/adkjfk7r)
#### + Laravel (php)
1. [Browser Sync + Laravel 4 (php server & proxy)](http://quick.as/03yt7bw)
2. [Browser Sync + Laravel 4 (Mamp Pro & proxy)](http://quick.as/996hozw)
3. [Browser Sync + Laravel 4 (Config file & Proxy)](http://quick.as/70js4da)
4. [Browser Sync + Laravel 4 (Config file & no proxy)](http://quick.as/j3gtmdz)
#### + Vagrant
1. [Browser Sync + Vagrant](http://quick.as/q0rs9jz)
## Screencasts
[Some listed here](https://github.com/shakyShane/browser-sync/wiki/Screencasts)
Want any more? Something specific? ask me nicely [@shaneOsbourne](http://www.twitter.com/shaneOsbourne)

@@ -65,7 +50,8 @@

```
416 Shane Osbourne
433 Shane Osbourne
13 Hugo Bessa
2 Paul Robertson
3 Marek 'saji' Augustynowicz
2 Hugo Dias
2 brutaldev
2 Paul Robertson
2 chase_chou

@@ -75,4 +61,5 @@ 1 Tony Holdstock-Brown

1 mericson
1 Cameron Spear
1 viktor hesselbom
1 Carl Henderson
1 viktor hesselbom
1 Dave Hall

@@ -87,2 +74,2 @@ 1 Guillaume Lambert

Copyright (c) 2013 Shane Osbourne
Licensed under the MIT license.
Licensed under the GPL license.

Sorry, the diff of this file is not supported yet

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