The next step in this is to get the browser to automatically refresh. The more efficient approach is to use a browser plugin that can listen for a signal from an application. However, a more convenient default is something like live.js (<a href="http://livejs.com">livejs.com</a>). Once injected into a page it polls the application for a new page by making a head request and checking a header like an ETag.<div>
<br><div class="gmail_quote">On Mon, Apr 18, 2011 at 7:56 AM, Michael Snoyman <span dir="ltr"><<a href="mailto:michael@snoyman.com">michael@snoyman.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div dir="ltr">Hi all,<div><br></div><div>Just wanted to let you know: there's been a minor delay in the 0.8 release of Yesod, all for good reasons. Rick Richardson and Greg Weber have put in a lot of work on the MongoDB backend for Persistent, and now we'll be able to include it (as an alpha) with this release. Congrats to them, this is very cool.</div>
<div><br></div><div>The second reason is that I decided to be naughty and completely disregard my feature freeze. As we've discussed recently, there are some issues with our hint-based wai-handler-devel approach. Without going into too many details (both to keep from boring you, and because I have very little time before Passover starts), I've made the following modifications to the yesod scaffolding tool:</div>
<div><br></div><div>* Running "yesod" by itself gives you a list of commands.</div><div>* Running "yesod init" gives the behavior previously held by "yesod", i.e. generate a scaffolded site.</div>
<div>* Running "yesod build" is *almost* identical to "cabal build", but with one change: it performs a dependency analysis of external files included by Template Haskell (Hamlet templates, routes, entity definitions) and changes modification times as needed to force cabal to build modules. For example, if "Handler/Root.hs" references "hamlet/root.hamlet", and the latter has a later modification time than the former, the former's modification times will be changed to match that of the latter.</div>
<div>* Running "yesod devel" runs devel server. Instead of using hint, the devel server now uses cabal for the compiling (passing in a special "devel" flag) and direct-plugins to load up the compiled code.</div>
<div><br></div><div>In order to make this work, there are a few necessary modifications to an individual site:</div><div><br></div><div>* The "Controller" module now needs to have a "withDevelApp" function, which must be of type "Dynamic". The internal type of this must be "(Application -> IO ()) -> IO ()".</div>
<div>* The cabal file must provide a library section. The library should only be built when the devel flag is passed in, it should be compiled with "-O0" (to speed up compiling) and executables are disabled (also for speed).</div>
<div>* direct-plugins can only load up installed packages, so "yesod devel" will actually install your package.</div><div>* The scaffolded site has already been updated to work properly with "yesod devel", so you can base your modifications on that.</div>
<div><br></div><div>The only bug I'm aware of right now is that if a file disappears at the wrong time then the call to get the modification time will fail. This may seem far fetched, but it happened to me when saving a file with vim. Shouldn't be too hard to fix, I just don't have time right now.</div>
<div><br></div><div>The code's on Yackage. If anyone wants to give it a shot, feel free.</div><div><br></div><font color="#888888"><div>Michael</div>
</font></div>
<br>_______________________________________________<br>
web-devel mailing list<br>
<a href="mailto:web-devel@haskell.org">web-devel@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/web-devel" target="_blank">http://www.haskell.org/mailman/listinfo/web-devel</a><br>
<br></blockquote></div><br></div>