<div dir="ltr"><br><div class="gmail_quote">On Thu, Aug 5, 2010 at 3:41 PM, Tim Matthews <span dir="ltr">&lt;<a href="mailto:tim.matthews7@gmail.com">tim.matthews7@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="gmail_quote"><div class="im">On Thu, Aug 5, 2010 at 11:33 PM, Mark Bradley <span dir="ltr">&lt;<a href="mailto:barkmadley@gmail.com" target="_blank">barkmadley@gmail.com</a>&gt;</span> wrote:<br><br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">


but CSS type checking might be possible within hamlet.<br></blockquote><div> </div></div><div>I have often wondered &quot;OK haml implemented now what about sass&quot;. Michael Snoyman what is your opinions on sass? Would a sass inspired syntax like you did with the haml-&gt;hamlet fit in well and if so, as it often best to keep styles separate, could a quasi quoted language live in in a separate haskell module and then at run time it recreates the separate css files on first launch?<br>

<br></div></div></blockquote><div><br></div><div>Tim and Mark,</div><div><br></div><div>Firstly, let me come clean about something: I got really lucky with Hamlet ;). I&#39;d never used Haml before, and was planning on writing a templating system. I saw the Haml syntax, thought it might be easy to implement, and everything turned out for the best. (Actually, first I thought of the name Hamlet and then decided I *had* to base my templating system on a Haml syntax, but that&#39;s beside the point ;)).</div>
<div><br></div><div>Anyway, regarding sass: I have no idea. I&#39;ve never used it, and have looked at it even less than I had looked at Haml. It has always seemed like it didn&#39;t give enough bang-for-the-buck versus plain CSS, but if we can get static typing out of it, that it&#39;s *definitely* worth it.</div>
<div><br></div><div>So the real question: how can we get static typing for CSS? And more importantly, what would that mean? It seems that it really applies to specifically two issues: ids and class names. Perhaps the right approach here is to allow Yesod to generate these names automatically; given the Widget framework, something along the lines of:</div>
<div><br></div><div>myWidget = do</div><div>    className &lt;- newIdent</div><div>    -- yes, addStyle currently uses Hamlet templates, with the release of blaze-builder, that will probably change</div><div>    addStyle [$hamlet|p.$className${color:red}|]</div>
<div>    addBody [$hamlet|%p.$className$ Red Text|]</div><div><br></div><div>There&#39;s also the approach of having a datatype for the CSS classes:</div><div><br></div><div>data MyClassNames = Red</div><div><br></div><div>
myWidget = do</div><div>    addStyle [$hamlet|p.$Red${color:red}|]</div><div>    addBody [$hamlet|%p.$Red$ Red Text|]</div><div><br></div><div>Or if we decide to create a sass quasi-quoter:</div><div><br></div><div>data MyClassNames = Red</div>
<div><br></div><div>myWidget = do</div><div>    addStyle [$sass| .... whatever this looks like |]</div><div>    addBody [$hamlet|%p.$Red$ Red Text|]</div><div><br></div><div>This is really just a random collection of thoughts I have on the topic, I haven&#39;t really thought anything out fully.</div>
<div><br></div><div>Michael</div></div></div>