【问题标题】:Setting up Grunt to serve Livereload over SSL设置 Grunt 以通过 SSL 服务 Livereload
【发布时间】:2015-03-14 14:13:05
【问题描述】:

我遵循了这个教程: 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 运行 livereload:端口 9000。 也许我错过了某些部分,例如“运行 Grunt 以使其加载到 grunt 文件”?

我得到的错误是:

GET https://localhost:9000/livereload.jsnet::ERR_CONNECTION_REFUSED

【问题讨论】:

  • 您找到问题的答案了吗?
  • 没有#maddog。不幸的是,我没有。一段时间后,我出于其他原因转移到另一个项目
  • 感谢您回来:)

标签: node.js ssl gruntjs


【解决方案1】:

Grunt-contrib-watch 使用不支持 SSL 的 tiny-lr@^0.2.1,需要有人提出拉取请求来升级 tiny-lr。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-03-18
    • 2013-11-18
    • 2015-12-23
    • 2010-12-09
    • 1970-01-01
    • 2017-10-04
    • 1970-01-01
    相关资源
    最近更新 更多