[web-devel] How exactly do you add cassius files to a hamlet template?

Michael Snoyman michael at snoyman.com
Fri Feb 18 04:56:27 CET 2011


On Fri, Feb 18, 2011 at 12:28 AM, Ian Duncan <iand675 at gmail.com> wrote:
> On Thursday, February 17, 2011 at 4:16 PM, Ian Duncan wrote:
>
> I assumed that I could change:
>     defaultLayout widget = do
>         mmsg <- getMessage
>         pc <- widgetToPageContent $ do
>             widget
>             addCassius $(Settings.cassiusFile "default-layout")
>         hamletToRepHtml $(Settings.hamletFile "default-layout")
> To:
>     defaultLayout widget = do
>         mmsg <- getMessage
>         pc <- widgetToPageContent $ do
>             widget
>             addCassius $(Settings.cassiusFile "other-stuff")
>             addCassius $(Settings.cassiusFile "default-layout")
>         hamletToRepHtml $(Settings.hamletFile "default-layout")
> And that it would minify other-stuff.cassius and include it, but this is
> clearly wrong. I also tried this:
>     defaultLayout widget = do
>         mmsg <- getMessage
>         pc <- widgetToPageContent $ do
>             widget
>             addCassius $(Settings.cassiusFile "other-stuff")
>         hamletToRepHtml $(Settings.hamletFile "default-layout")
> Replacing default-layout completely, and it didn't work either. What am I
> doing wrong here?
> --
> Ian Duncan
>
> Actually, turns out it's a bug in Cassius. It apparently ignores any
> non-indented declarations, even if they are within curly braces. Solved it
> by reformatting by cassius code. Filing a bug report on the Hamlet package.

For the moment, Cassius specifically does *not* try to be a simple
extension of CSS3, though I suppose supporting this specific use case
won't break the syntax. I don't mind adding support for this, but I
think the better solution is to start working on Lucius.

Aur Saraf made a good argument for ditching the whitespace-sensitive
syntax for CSS entirely. I'm in favor of leaving it in for those who
like it (possibly deprecating it if it turns out *no one* likes it),
and providing an alternative template language which follows the Less
style.

Michael



More information about the web-devel mailing list