正想拿 Middleman 來做網頁的時候,想到還沒安裝,就 gem install middleman
沒想到安裝好之後,把 guard-livereload 等套件都配置好。
打開 LiveReload 並且更新 source/index.html.erb 雖然頁面重新整理,但是 index.html.erb 卻沒有任何變化。
Chrome 已經關閉快取,也用沒有開過的 Firefox 打開看看。
都無法順利運行,直到touch tmp/restart.txt重新啟動後才出現更新的頁面。
不知道大家是否也碰上這個問題?
(我有用 rack-livereload 搭配,但是即使關掉也存在這個問題)
後來觀察發現跟 Apache 有關(我是用 Proxy 導向 Pow )
但是卻找不到影響的設定在哪(Octopress 跟 Rails 都能正常更新)
只有網頁會這樣,修改 js 檔則正常更新。
重新啟動 Apache 等都沒有效果,只有重新啟動(rack)跟 pow 有效果
我已經混亂了 Orz
昨晚寄信得到的回覆:
Unfortunately, that is correct. The Rack (config.ru) support is intended for showing off a completed site (not production exactly, more like review) on a web server.
The file watcher doesn't run without the middleman
command. You may be able to hook up a third party file watcher, like Guard, in conjunction with tmp/restart.txt to have something that functions similarly, but it will like be slow.
剛剛的測試也不是 Apache 方面問題,範圍縮小到 rack 的部分。
不過以前用 2.x 的時候都能正常(搭配 pow 和 rack)但是現在 3.0 為何不能使用還是不解。
官方說法似乎是只有在運行 middleman 這個 command 才會有 file watcher 的功能,但是我用了 guard-livereload 卻也沒有效果 Orz
總結一下……
最後確認是 Rack 部分的問題,在 rack 用的設定沒有 file watcher 功能。
(就如官方所說)
有人知道什麼解決方案呢?
(使用 Guard Livereload 卻沒辦法順利更新頁面,但 CSS, JS 等都正常被更新)
找到一個笨方法:tmp/always_restart.txt
這樣每次都會重新啟動 rack 不過就是……很慢