diff --git a/README.md b/README.md index 814f3cd..f895300 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# grunt-contrib-watch v0.5.3 [![Build Status](https://travis-ci.org/gruntjs/grunt-contrib-watch.png?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-watch) +# grunt-contrib-watch [![Build Status](https://travis-ci.org/gruntjs/grunt-contrib-watch.png?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-watch) > Run predefined tasks whenever watched file patterns are added, changed or deleted. @@ -177,6 +177,29 @@ watch: { }, ``` +<<<<<<< HEAD +======= +It's possible to get livereload working over https connections. To do this, pass an object to `livereload` with a `key` and `cert` paths specified. + +Example: +```js +watch: { + css: { + files: '**/*.sass', + tasks: ['sass'], + options: { + livereload: { + port: 9000, + key: 'path/to/ssl.key', + cert: 'path/to/ssl.crt' + } + }, + }, +}, +``` + + +>>>>>>> Enable live reload to work over https connections #### options.cwd Type: `String|Object` Default: `process.cwd()` @@ -328,7 +351,7 @@ grunt.initConfig({ Once you've started a live reload server you'll be able to access the live reload script. To enable live reload on your page, add a script tag before your closing `` tag pointing to the `livereload.js` script: ```html - + ``` Feel free to add this script to your template situation and toggle with some sort of `dev` flag. diff --git a/docs/watch-examples.md b/docs/watch-examples.md index 8ec779b..c1ce170 100644 --- a/docs/watch-examples.md +++ b/docs/watch-examples.md @@ -143,7 +143,7 @@ grunt.initConfig({ Once you've started a live reload server you'll be able to access the live reload script. To enable live reload on your page, add a script tag before your closing `` tag pointing to the `livereload.js` script: ```html - + ``` Feel free to add this script to your template situation and toggle with some sort of `dev` flag. diff --git a/docs/watch-options.md b/docs/watch-options.md index dfc7de0..9561563 100644 --- a/docs/watch-options.md +++ b/docs/watch-options.md @@ -149,6 +149,26 @@ watch: { }, ``` +It's possible to get livereload working over https connections. To do this, pass an object to `livereload` with a `key` and `cert` paths specified. + +Example: +```js +watch: { + css: { + files: '**/*.sass', + tasks: ['sass'], + options: { + livereload: { + port: 9000, + key: 'path/to/ssl.key', + cert: 'path/to/ssl.crt' + } + }, + }, +}, +``` + + ## options.cwd Type: `String|Object` Default: `process.cwd()` diff --git a/package.json b/package.json index 9e79cff..2326434 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ }, "dependencies": { "gaze": "~0.4.0", - "tiny-lr": "0.0.4" + "tiny-lr": "0.0.5" }, "devDependencies": { "grunt": "~0.4.0", diff --git a/tasks/lib/livereload.js b/tasks/lib/livereload.js index 9abf530..a1662e9 100644 --- a/tasks/lib/livereload.js +++ b/tasks/lib/livereload.js @@ -28,7 +28,12 @@ module.exports = function(grunt) { if (servers[options.port]) { this.server = servers[options.port]; } else { - this.server = tinylr(); + if (options.key && options.cert) { + options.key = grunt.file.read(options.key); + options.cert = grunt.file.read(options.cert); + } + + this.server = tinylr(options); this.server.server.removeAllListeners('error'); this.server.server.on('error', function(err) { if (err.code === 'EADDRINUSE') {