2013-07-02 44 views
0

我在Grunt中遇到了一些問題,它正在編譯我的Sass/SCSS文件(我正在使用.scss),但它不會LiveReload。我正在使用集成LiveReload功能的'watch'依賴項。Grunt不能實時重新加載Sass/SCSS(NodeJS)

關注:https://github.com/gruntjs/grunt-contrib-watch 薩斯/ SCSS:https://github.com/gruntjs/grunt-contrib-sass

這裏的下面我的配置(相關部分),任何人都可以提出建議,以我要去哪裏錯了嗎?它生活重新加載其他文件和文件夾。

grunt.initConfig({ 
    connect: { 
     options: { 
      port: 9000, 
      hostname: 'localhost' 
     }, 
     livereload: { 
      options: { 
       middleware: function (connect) { 
        return [ 
         mountFolder(connect, 'app'), 
         lrSnippet 
        ]; 
       } 
      } 
     } 
    }, 
    open: { 
     server: { 
      path: 'http://localhost:<%= connect.options.port %>' 
     } 
    }, 
    sass: { 
     app: { 
      files: { 
       './app/css/style.min.css': 'app/css/scss/style.scss' 
      } 
     } 
    }, 
    watch: { 
     options: { 
      nospawn: true 
     }, 
     css: { 
      files: './app/css/scss/*.scss', 
      tasks: ['sass'], 
      options: { 
       livereload: true, 
      }, 
     }, 
     livereload: { 
      options: { 
       livereload: LIVERELOAD_PORT 
      }, 
      files: [ 
       'app/{,*/}*.html', 
       'app/css/{,*/}*.{css,scss,sass}', 
       'app/js/{,*/}*.js', 
       'app/img/{,*/}*.{png,jpg,jpeg,gif,webp,svg}' 
      ] 
     } 
    } 
}); 

回答

0

而不是使用連接中間件,請嘗試使用這樣的事情在你的手錶任務(CoffeeScript的Gruntfile語法如下):

watch: 

    livereload: 
    files: "path/to/generated/css" 
    options: 
     livereload: true 
相關問題