我遵循了这个教程: http://www.gilluminate.com/2014/06/10/livereload-ssl-https-grunt-watch/
我的Gruntfile.js看起来像这样:
module.exports = function(grunt) {
grunt.initConfig({
jshint: {
files: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js'],
options: {
globals: {
jQuery: true
}
}
},
watch: {
css: {
files: '**/*.sass',
tasks: ['sass'],
options: {
livereload: {
port: 9000,
key: grunt.file.read('ssl/livereload.key'),
cert: grunt.file.read('ssl/livereload.crt')
// you can pass in any other options you'd like to the https server, as listed here: http://nodejs.org/api/tls.html#tls_tls_createserver_options_secureconnectionlistener
}
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['jshint']);
};
我添加了
<script src="//localhost:9000/livereload.js"></script>
在我的index.html文件的末尾。
我的目标是通过httpS:端口9000运行livereload。 也许我错过了一些部分,例如&#34;运行Grunt以使其加载到grunt文件&#34;?
我得到的错误是:
获取https://localhost:9000/livereload.js net :: ERR_CONNECTION_REFUSED
答案 0 :(得分:-1)
Grunt-contrib-watch使用tiny-lr@^0.2.1,它不支持SSL,有人需要提出拉取请求来升级tiny-lr。