browser-sync
Advanced tools
Comparing version 0.7.7 to 0.8.0
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
251728
2248
13
3
70
72
+ Addedbrowser-sync-client@0.1.4(transitive)
- Removedalign-text@0.1.4(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedbrowser-sync-client@0.0.5(transitive)
- Removedcamelcase@1.2.1(transitive)
- Removedcenter-align@0.1.3(transitive)
- Removedcliui@2.1.0(transitive)
- Removedclone-stats@0.0.1(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removedfind-index@0.1.1(transitive)
- Removedglob@4.5.3(transitive)
- Removedglob-stream@3.1.18(transitive)
- Removedglob-watcher@0.0.6(transitive)
- Removedglob2base@0.0.12(transitive)
- Removedgraceful-fs@2.0.3(transitive)
- Removedinflight@1.0.6(transitive)
- Removedis-buffer@1.1.6(transitive)
- Removedkind-of@3.2.2(transitive)
- Removedlazy-cache@1.0.4(transitive)
- Removedlongest@1.0.1(transitive)
- Removedmap-stream@0.1.0(transitive)
- Removedminimatch@2.0.10(transitive)
- Removedmkdirp@0.3.5(transitive)
- Removedobject-keys@0.4.0(transitive)
- Removedonce@1.4.0(transitive)
- Removedordered-read-streams@0.1.0(transitive)
- Removedreadable-stream@1.0.34(transitive)
- Removedrepeat-string@1.6.1(transitive)
- Removedright-align@0.1.3(transitive)
- Removedsource-map@0.5.7(transitive)
- Removedthrough2@0.4.20.6.5(transitive)
- Removeduglify-js@2.8.29(transitive)
- Removeduglify-to-browserify@1.0.2(transitive)
- Removedunique-stream@1.0.0(transitive)
- Removedvinyl@0.2.3(transitive)
- Removedvinyl-fs@0.1.4(transitive)
- Removedwindow-size@0.1.0(transitive)
- Removedwordwrap@0.0.2(transitive)
- Removedwrappy@1.0.2(transitive)
- Removedxtend@2.1.24.0.2(transitive)
- Removedyargs@3.10.0(transitive)
Updatedbrowser-sync-client@0.1.4