2016-02-09 47 views
1

我已經設定,像咕嚕說,我有以下代碼,咕嚕正確觀看和livereload.js在端口上運行35729.咕嚕本地主機:9000/index.html的不運行

我的問題是,我看不到我的本地主機上運行的index.html。 我錯過了什麼?

module.exports = function(grunt) { 

    grunt.initConfig({ 
     compass: { 
      dev: { 
       options: { 
        config: 'config.rb' 
       } 
      } 
     }, 
     watch: { 
      css: { 
      files: 'sass/*.scss', 
      tasks: ['sass'], 
      options: { livereload: true } 
      }, 
      livereload: { 
      options: { livereload: true }, 
      files: [ 
       '{,*/}*.html', 
       '*.html', 
       'assets/images/{,*/}*', 
       'assets/js/*.js' 
      ] 
     }, 
     options: { 
      livereload: true, 
     }, 

      html: { 
       options: { livereload: true }, 
       files: ['*.html'] 
      }, 
      sass: { 
       options: { livereload: true }, 
       files: ['sass/*.scss'], 
       tasks: ['compass:dev'] 
      }, 
      options: { 
       livereload: true 
      }, 
      js: { 
       options: { livereload: true }, 
       files: ['assets/js/*.js'], 
       tasks: ['jshint'] 
      }, 
      images: { 
       options: { livereload: true }, 
       files: ['assets/images/*.*'] 
      }, 
      fontsicons: { 
       options: { livereload: true }, 
       files: ['assets/images/icons/**/*.{svg,eot,woff,ttf,woff2,otf}'], 
       tasks: ['copy:fontsicons'] 
      } 
     }, 
     connect: { 
      connect: { 
       options: { 
        port: 9000, 
        livereload: 35729, 
        hostname: 'localhost' 
       }, 
       livereload: { 
        options: { 
         open: true, 
         base: [ 
          'app' 
         ] 
        } 
       } 
      } 
     } 
    }); 
    grunt.loadNpmTasks('grunt-contrib-connect'); 
    grunt.loadNpmTasks('grunt-contrib-watch'); 
    grunt.loadNpmTasks('grunt-contrib-compass'); 
    grunt.registerTask('default', ['watch','compass','connect']); 
} //exports 
+0

你試過端口:9000嗎? –

+0

@RobertMoskal我的locahost是本地主機:9000/index.html – user3699998

回答

1

默認情況下,grunt-contrib-connect服務器只在grunt模塊運行時運行:https://github.com/gruntjs/grunt-contrib-connect#keepalive

添加的存活關鍵是你的選擇:

connect: { 
     connect: { 
      options: { 
       port: 9000, 
       livereload: 35729, 
       keepalive: true, 
       hostname: 'localhost' 
      }, 

請記住,沒有其他任務將在一個運行後,當你使用存活。但從你的gruntfile看起來很好。

+0

感謝您的關注此,仍然給我「此網頁不可用」 不知道爲什麼,看起來沒有看到或找到我的index.html – user3699998