2014-04-04 36 views
0

不知道這是否是我的錯誤或錯誤配置,但使用grunt觀看一些sass文件時,它絕對會觀看文件,但只能編譯sass和更新我退出觀察者時的目標文件。grunt watch - 編譯sass,但只能在手錶結束後

這裏是我的手錶節點:

watch: { 
    sass : { 
     files: [sassPath.scss], 
     tasks: ['sass'] 
    } 
} 

例如,這在什麼是目前發生的事情:

1. I do `grunt watch` on the command line 
2. Start editing sass files 
3. Command line notifies me that the change has been detected and it runs the sass task successfully 
4. I manually look at the destination css file - no changes 
5. ctrl + c to close the watcher while looking in the destination css file - i can see it updated as soon as the watch closes 

我真的想目標css文件儘快青菜編譯

更新
+0

我沒有看到你的'咕嚕表:sass'任務有什麼問題。你有沒有試過自己運行它?對於'watch'任務來說這不是一種常見的行爲,但我必須仔細看看你的'Gruntfile.js'來看看是否有其他問題。嘗試更新你的本地'grunt'和相關的依賴項('watch'和'sass')。 –

回答

0

是的,似乎有一個錯誤,在某些更新,可以防止您的gruntfile.js工作,我有同樣的問題,並通過作曲家更新後的一天文件只是sto我不得不改變手錶部分看起來像這樣,並修復它:

 // Watch for files and folder changes 
    watch: { 
     sass: { 
      files: ['<%= options.sass.base %>/{,*/}*.{scss,sass}'], 
      tasks: ['sass'] 
     }, 
     livereload: { 
      options: { 
       livereload: 35729, 
      }, 
      files: [ 
       'app/views/*/*.php', 
       '{tmp/<%= options.css.base %>,<%= options.css.base %>}/{,*/}*.css', 
       '{tmp/<%= options.js.base %>,<%= options.js.base %>}/{,*/}*.js', 
       '{tmp/<%= options.sass.base %>,<%= options.sass.base %>}/{,*/}*.css', 
      ] 
     }, 
     options: { 
      livereload: true 
     }, 
     files: '<%= options.watch.files %>', 
     tasks: ['default', 'notify:watch'] 
    } 
+0

他的配置沒有什麼必要錯 - 就他的描述和代碼而言。但是如果沒有看到他的'Gruntfile.js',就不可能知道一切正常。當然,有人可能會對「watch」任務感興趣,但我不認爲這個答案對他描述的問題增加了很多價值(正如寫作時那樣)......因爲你基本上在做他也是這樣做的,有着鐘聲和口哨聲。 :)和平。 –

+0

@WallaceSidhrée對於我已經在github上報告過的bug,這個鐘聲和哨聲是一個臨時修復。我應該提到這一點! – Neo

相關問題