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

Passing an 'ignore' option to connect-livereload to address problems with binary downloads. #214

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ Setting it to `'*'`, like '`0.0.0.0`', will make the server accessible from any

If [`open`](#open) is set to `true`, the `hostname` setting will be used to generate the URL that is opened by the browser, defaulting to `localhost` if a wildcard hostname was specified.

#### ignore
Type: `Array`

An array of Strings or RegExps the served urls will be matched against and excluded live-reloading. This makes possible to workaround a problem with damaged binary data (in case there is no explicit e.g. .pdf in the url itself - see discussion here: https://github.com/gruntjs/grunt-contrib-connect/issues/142)
The value is passed as-is to the underlying https://github.com/intesso/connect-livereload middleware and it is documented there.

#### base
Type: `String` or `Array` or `Object`
Default: `'.'`
Expand Down
7 changes: 6 additions & 1 deletion tasks/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,12 @@ module.exports = function(grunt) {
}

// TODO: Add custom ports here?
middleware.unshift(injectLiveReload({port: options.livereload, hostname: options.hostname}));
var liveReloadOpts = {port: options.livereload, hostname: options.hostname};
// pass the ignore options - to address a problem: https://github.com/intesso/connect-livereload/issues/39
if (options.ignore) {
liveReloadOpts.ignore = options.ignore;
}
middleware.unshift(injectLiveReload(liveReloadOpts));
callback(null);
} else {
callback(null);
Expand Down