Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes on documentation (proposal) #1461

Closed
wants to merge 49 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
475588b
#970 Fix: Change SHA-1 to SHA-256 cert
martindsouza Jan 22, 2016
069927a
fix(ui): bump ui to remove cache headers to fix #1152
shakyShane Dec 11, 2016
ed71efc
2.18.3
shakyShane Dec 11, 2016
348597e
fix(ports): bump portscanner -> 2.1.1 to fix issues with string types
shakyShane Dec 11, 2016
2778b14
2.18.4
shakyShane Dec 11, 2016
5746320
fix(client): bump client script to fix #1102
shakyShane Dec 11, 2016
473fd62
2.18.5
shakyShane Dec 11, 2016
ad15cfa
updated recipes
shakyShane Jan 6, 2017
f67aced
2.18.6
shakyShane Jan 6, 2017
782bb91
Unit tests need to be updated to reflect 'Jade' rename to 'Pug' - fix…
shakyShane Jan 30, 2017
af9ba60
deps: update browser-sync-ui to fix https://github.com/BrowserSync/UI…
shakyShane Jan 30, 2017
838c837
2.18.7
shakyShane Jan 30, 2017
c6d7d16
fix(notify): always send `override: true` on public notify method
shakyShane Feb 13, 2017
7e36ce1
tests: update for override: true on public notify message
shakyShane Feb 13, 2017
5d1e084
deps: bump browser-sync-client re: https://github.com/BrowserSync/bro…
shakyShane Feb 13, 2017
de2e2fa
fix(files): added `watchEvents` option
shakyShane Feb 13, 2017
a1fbcf0
rework reloadDebounce
shakyShane Feb 13, 2017
9d741d0
ensure stream api also conforms to reloadDelay and reloadDebounce
shakyShane Feb 13, 2017
4b14c3b
chore: cleanup/comments
shakyShane Feb 13, 2017
5b00707
Merge branch 'reload-debounce'
shakyShane Feb 13, 2017
2229394
limit file handling to core namespace
shakyShane Feb 13, 2017
a6bba5a
ignore all file change events if `codeSync: false`
shakyShane Feb 13, 2017
9e0a170
2.18.8
shakyShane Feb 13, 2017
d5196ce
Bumps request to 2.79.0
lucalanca Feb 16, 2017
81adf91
Merge pull request #1320 from lucalanca/master
shakyShane Apr 10, 2017
68dcfe1
docs: fix formatting of `open` option - closes https://github.com/Bro…
shakyShane Apr 10, 2017
8d1b6f0
Merge pull request #975 from martindsouza/master
shakyShane Apr 10, 2017
cbe2ccb
server: stronger certs
shakyShane Apr 10, 2017
0aa00a7
Improve documentation for steam
docwhat Apr 15, 2017
d573cfe
deps: browser-sync-client@2.4.7, chokidar@1.7.0, fs-extra@3.0.1, serv…
shakyShane May 15, 2017
2946065
Remove < 4 on appveyor
shakyShane May 15, 2017
d640213
ci: attempt to pass on windows
shakyShane May 15, 2017
0452c8d
ci: attempt to pass on windows
shakyShane May 15, 2017
fb0e154
deps: update mocha@3.4.1
shakyShane May 15, 2017
b2955fc
2.18.9
shakyShane May 15, 2017
1a0505c
fix(ghostMode): ensure `.location` defaults to true - fixes https://g…
shakyShane May 15, 2017
a9e313e
2.18.10
shakyShane May 15, 2017
c990ea2
fix(sourcemaps): let the client decide how to handle sourcemaps (so i…
shakyShane May 15, 2017
510fde4
2.18.11
shakyShane May 15, 2017
08f4da0
Set default logPrefix to "Browsersync". Closes #1377
joemaller May 16, 2017
a1be1ad
fix(client): update browser-sync clients - fixes #1379
shakyShane May 21, 2017
8d1e298
2.18.12
shakyShane May 21, 2017
4ff95ec
Upgrade localtunnel to 1.8.3.
swashcap Jun 26, 2017
470ab02
Merge pull request #1403 from swashcap/upgrade/localtunnel
shakyShane Jul 4, 2017
c64c120
Merge pull request #1359 from docwhat/patch-1
shakyShane Jul 4, 2017
bf53394
Merge pull request #1378 from joemaller/master
shakyShane Jul 4, 2017
d3d871d
chore(tests): cleanup to remove flaky tests
shakyShane Jul 4, 2017
f015a29
2.18.13
shakyShane Jul 20, 2017
a0bfc96
Minor fixes (proposal)
kant Dec 3, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 5 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Contributing to Browsersync
# Contributing to Browsersync

We'd love for you to contribute to Browsersync and help make it even better than it is
today! Here are the guidelines we'd like you to follow:
Expand Down Expand Up @@ -35,8 +35,7 @@ then it's very likely to fall to the bottom of the heap. Help us out by providin
* Provide a reduced test case. "Browsersync is not working with my app" is far less helpful than "Here's a example project showing the problem".
An example project might contain a single `index.html` file with some JS/CSS from CDNs & a short description of the issue. If we
can just pull a repo/gist and see the problem for ourselves, your issue will jump straight to the top of the stack.
* Screencast or GIF - not always appropriate, but can be very helpful where possible. (non-issue related gifs are always welcome, we'll often
respond with something from giphy :p)
* Screencast or GIF - not always appropriate, but can be very helpful where possible. (non-issue related gifs are always welcome, we'll often respond with something from giphy :p)

## <a name="feature"></a> Want a Feature?
You can request a new feature by submitting an issue to our [Github Issues](https://github.com/BrowserSync/browser-sync/issues) page.
Expand All @@ -49,9 +48,9 @@ Head over to the [Browsersync Website Repo](https://github.com/BrowserSync/brows
Pull requests should always be branched off the main **Master** branch. (There's no guarantee that what lives on the develop
branch will ever make it back to master, I do a **lot** of experimentation).

Never commit directly to the master branch, instead create a new branch and submit a PR. This applies to users who have write access also.
**Never** commit directly to the master branch, instead create a new branch and submit a PR. This applies to users who have write access also.

Note: If your first PR is merged, you'll get write access to all Browsersync repos.
**Note:** If your first PR is merged, you'll get write access to all Browsersync repos.

## <a name="rules"></a> Coding Advice
To ensure consistency throughout the source code, keep these rules in mind as you are working.
Expand All @@ -66,5 +65,4 @@ To ensure consistency throughout the source code, keep these rules in mind as yo
If *you* have particular experience though, then feel free to rip my code apart and tell me a better way to do something - I'll be extremely grateful (as will the growing number of users!).

## <a name="thanks"></a> Thank you!
If you contribute to Browsersync, or any other Open Source project, you're awesome! This project has been vastly improved
by community input & contributions and we look forward to continuing that trend.
If you contribute to Browsersync, or any other Open Source project, you're awesome! This project has been vastly improved by community input & contributions and we look forward to continuing that trend.
1 change: 0 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ environment:
matrix:
- nodejs_version: '6'
- nodejs_version: '4'
- nodejs_version: '0'

install:
- ps: Install-Product node $env:nodejs_version
Expand Down
45 changes: 30 additions & 15 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
"use strict";

var gulp = require("gulp");
var contribs = require("gulp-contribs");
var conventionalChangelog = require("gulp-conventional-changelog");
var bs = require("./").create();
var Rx = require("rx");
// var contribs = require("gulp-contribs");
// var conventionalChangelog = require("gulp-conventional-changelog");
//
// gulp.task("contribs", function () {
// gulp.src("README.md")
// .pipe(contribs())
// .pipe(gulp.dest(""));
// });
//
// gulp.task("changelog", function () {
// return gulp.src("CHANGELOG.md", {
// buffer: false
// })
// .pipe(conventionalChangelog({
// preset: "angular"
// }))
// .pipe(gulp.dest("./"));
// });

gulp.task("contribs", function () {
gulp.src("README.md")
.pipe(contribs())
.pipe(gulp.dest(""));
});
gulp.task("dev", function() {

bs.init({
server: "test/fixtures",
open: false,
reloadDelay: 1000,
reloadDebounce: 1000
});

gulp.task("changelog", function () {
return gulp.src("CHANGELOG.md", {
buffer: false
})
.pipe(conventionalChangelog({
preset: "angular"
}))
.pipe(gulp.dest("./"));
gulp.src("lib/**")
.pipe(bs.stream())
});
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ module.exports.reload = noop("reload");
*
* @method stream
* @param {Object} [opts] Configuration for the stream method
* @param {Object} [opts.match] Resulting files to reload. The path is from the
* root of the site (not the root of your project). You can use '**' to recurse
* directories.
* @param {Object} [opts.once] Only reload on the first changed file in teh stream.
* @since 2.6.0
* @returns {*}
*/
Expand Down
42 changes: 0 additions & 42 deletions lib/browser-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -633,48 +633,6 @@ BrowserSync.prototype.resetMiddlewareStack = function () {
bs.app.stack = middlewares;
};

/**
* Handle Browser Reloads
*/
BrowserSync.prototype.doBrowserReload = function () {

var bs = this;

if (bs._browserReload) {
return;
}
bs._browserReload = setTimeout(function () {
bs.io.sockets.emit("browser:reload");
clearTimeout(bs._browserReload);
bs._browserReload = false;
}, bs.options.get("reloadDelay"));
};

/**
* Handle a queue of reloads
* @param {Object} data
*/
BrowserSync.prototype.doFileReload = function (data) {

var bs = this;

var willReload = utils.willCauseReload(
[data.path],
bs.options.get("injectFileTypes").toJS()
);

/**
* If the current item will cause the browser
* to reload, fire the correct
*/
if (willReload) {
bs.io.sockets.emit("browser:reload");
return;
}

bs.io.sockets.emit("file:reload", data);
};

/**
* @param fn
*/
Expand Down
4 changes: 4 additions & 0 deletions lib/cli/opts.start.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@
"type": "number",
"desc": "Specify a port for the UI to use"
},
"watchEvents": {
"type": "array",
"desc": "Specify which file events to respond to"
},
"no-notify": {
"desc": "Disable the notify element in browsers"
},
Expand Down
24 changes: 18 additions & 6 deletions lib/default-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ module.exports = {
*/
files: false,

/**
* Specify which file events to respond to.
* Available events: `add`, `change`, `unlink`, `addDir`, `unlinkDir`
* @property watchEvents
* @type Array
* @default ["change"]
* @since 2.18.8
*/
watchEvents: ["change"],

/**
* File watching options that get passed along to [Chokidar](https://github.com/paulmillr/chokidar).
* Check their docs for available options
Expand All @@ -40,11 +50,11 @@ module.exports = {
* @since 2.6.0
*/
watchOptions: {
ignoreInitial: true
/*
persistent: true,

ignored: '*.txt',
ignoreInitial: false,
followSymlinks: true,
cwd: '.',

Expand Down Expand Up @@ -130,13 +140,14 @@ module.exports = {
* @type string
* @default undefined
* @since 2.18.0
*/
*/

/**
* Clicks, Scrolls & Form inputs on any device will be mirrored to all others.
* @property ghostMode
* @param {Boolean} [clicks=true]
* @param {Boolean} [scroll=true]
* @param {Boolean} [location=true]
* @param {Boolean} [forms=true]
* @param {Boolean} [forms.submit=true]
* @param {Boolean} [forms.inputs=true]
Expand All @@ -146,6 +157,7 @@ module.exports = {
ghostMode: {
clicks: true,
scroll: true,
location: true,
forms: {
submit: true,
inputs: true,
Expand All @@ -166,10 +178,10 @@ module.exports = {
* own project based on Browsersync
* @property logPrefix
* @type String
* @default BS
* @default Browsersync
* @since 1.5.1
*/
logPrefix: "BS",
logPrefix: "Browsersync",

/**
* @property logConnections
Expand Down Expand Up @@ -245,7 +257,7 @@ module.exports = {

/**
* Decide which URL to open automatically when Browsersync starts. Defaults to "local" if none set.
* Can be true, `local`, `external`, `ui`, `ui-external`, `tunnel` or `false`
* Can be `true`, `local`, `external`, `ui`, `ui-external`, `tunnel` or `false`
* @property open
* @type Boolean|String
* @default true
Expand Down Expand Up @@ -501,7 +513,7 @@ module.exports = {
"js": "script"
},

injectFileTypes: ["css", "png", "jpg", "jpeg", "svg", "gif", "webp"],
injectFileTypes: ["css", "png", "jpg", "jpeg", "svg", "gif", "webp", "map"],
excludedFileTypes: [
"js",
"css",
Expand Down
120 changes: 120 additions & 0 deletions lib/file-event-handler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
var utils = require("./utils");

/**
* Apply the operators that apply to the 'file:changed' event
* @param {Rx.Observable} subject
* @param options
* @return {Rx.Observable<{type: string, files: Array<any>}>}
*/
function fileChanges(subject, options) {
var operators = [
{
option: "reloadThrottle",
fnName: "throttle"
},
{
option: "reloadDelay",
fnName: "delay"
}
];

var scheduler = options.getIn(["debug", "scheduler"]);

/**
* if the 'reloadDebounce' option was provided, create
* a stream buffered/debounced stream of events
*/
var initial = (function() {
if (options.get("reloadDebounce") > 0) {
return getAggregatedDebouncedStream(subject, options, scheduler);
}
return subject;
})();

return applyOperators(operators, initial, options, scheduler)
.map(function(xs) {

var items = [].concat(xs);
var paths = items.map(function (x) { return x.path });

if (utils.willCauseReload(paths, options.get("injectFileTypes").toJS())) {
return {
type: "reload",
files: items
}
}
return {
type: "inject",
files: items
}
});
}
module.exports.fileChanges = fileChanges;

/**
* Apply the operators that apply to the 'browser:reload' event
* @param {Rx.Observable} subject
* @param options
* @returns {Rx.Observable}
*/
function applyReloadOperators (subject, options) {
var operators = [
{
option: "reloadDebounce",
fnName: "debounce"
},
{
option: "reloadThrottle",
fnName: "throttle"
},
{
option: "reloadDelay",
fnName: "delay"
}
];

return applyOperators(operators, subject, options, options.getIn(["debug", "scheduler"]));
}
module.exports.applyReloadOperators = applyReloadOperators;

/**
* @param items
* @param subject
* @param options
* @param scheduler
*/
function applyOperators (items, subject, options, scheduler) {
return items.reduce(function(subject, item) {
var value = options.get(item.option);
if (value > 0) {
return subject[item.fnName].call(subject, value, scheduler);
}
return subject;
}, subject);
}

/**
* @param subject
* @param options
* @param scheduler
*/
function getAggregatedDebouncedStream (subject, options, scheduler) {
return subject
.filter(function(x) { return options.get("watchEvents").indexOf(x.event) > -1 })
.buffer(subject.debounce(options.get("reloadDebounce"), scheduler))
.map(function(buffered) {
return buffered.reduce(function (acc, item) {
if (!acc[item.path]) acc[item.path] = item;
if (acc[item.path]) acc[item.path] = item;
return acc;
}, {});
})
.map(function(group) {
return Object
.keys(group)
.map(function(key) {
return group[key];
});
})
.filter(function (x) { return x.length })
}
3 changes: 2 additions & 1 deletion lib/file-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var fileUtils = {
* `add` `unlink` etc etc so we need to check for that and only
* respond to 'change', for now.
*/
if (data.event === "change") {
if (bs.options.get("watchEvents").indexOf(data.event) > -1) {
if (!bs.paused && data.namespace === "core") {
bs.events.emit("file:reload", fileUtils.getFileInfo(data, bs.options));
}
Expand All @@ -41,6 +41,7 @@ var fileUtils = {
ext: data.ext,
path: data.path,
basename: data.basename,
event: data.event,
type: "inject"
};

Expand Down