LiveReload を有効にするために、grunt-contrib-watch タスク (v. 0.5.3) を使用します。
livereload: {
options: {
middleware: function (connect) {
return [lrSnippet, mountFolder(connect, '.tmp'),
mountFolder(connect, 'src'),
proxySnippet];
}
}
}
//...some other tasks...
watch: {
livereload: {
options: {
livereload: LIVERELOAD_PORT
},
files: [
'src/*.html'
]
}
}
//...................................
grunt.registerTask('server', [
'clean:server',
'recess:compile',
'configureProxies',
'connect:livereload',
'open',
'watch'
]);
実行中grunt server --verbose
(watch
タスクを含む)、次のコンソール出力が表示されます。
Running "watch" task
Waiting...Verifying property watch exists in config...OK
Verifying property watch.livereload.files exists in config...OK
Live reload server started on port: 35729
Watching src/404.html for changes.
Watching src/app for changes.
Watching src/assets for changes.
Watching src/common for changes.
Watching src/less for changes.
Watching src/vendor for changes.
Watching src/index.html for changes.
たとえば、ここでsrc/index.html
観察されていることがわかります。したがって、ページのタイトルを変更して、ライブの変更を確認しようとします。しかし、ファイルを保存するとすぐにプロセスが終了します..
watch
指定されたファイルパスが無効な場合、タスクが終了する可能性があるという事実について読みました。しかし、Watching src/index.html for changes
それが存在すると主張していますよね?
私はそれを理解していません。