[Haskell-cafe] Re: [web-devel] statically compiled css

Michael Snoyman michael at snoyman.com
Fri Aug 6 04:19:52 EDT 2010

On Thu, Aug 5, 2010 at 3:41 PM, Tim Matthews <tim.matthews7 at gmail.com>wrote:

> On Thu, Aug 5, 2010 at 11:33 PM, Mark Bradley <barkmadley at gmail.com>wrote:
> but CSS type checking might be possible within hamlet.
> I have often wondered "OK haml implemented now what about sass". Michael
> Snoyman what is your opinions on sass? Would a sass inspired syntax like you
> did with the haml->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?
> After looking into sass a little bit, I've decided I like it ;). I see the
following benefits of implementing something sass-like in Haskell via

* Compile-time guarantee of well-formedness.
* The speed benefits of blaze-builder. Of course, this will still be slower
than serving a static file.
* Ability to use the same Haskell variables for both Hamlet and CSS.

I've started a new repo on Github[1]; I'm tentatively calling the project
"stylish". So far, I've gotten a quasi-quoter that handles nesting working,
and it's all built on top of blaze-builder. Here's some design decisions
that are up for grabs:

* I think the older sass syntax (whitespace sensitive) is a better call than
the newer scss syntax (a superset of CSS). It fits in better with Hamlet and
looks more like Haskell code.
* I'm not planning on implementing variable declarations within a Stylish
template; instead, it will use Haskell variables like Hamlet.
* I think mixins could be an awesome feature, but I think they'll be
implemented much closer to how embedding of templates works in Hamlet. I'm
thinking there will be a separate stylishMixin quasi-quoter.
* Sass has special support for colors and unit measurements. I think we
could provide the same thing with Haskell datatypes.

Another thing to consider is just throwing this in with Hamlet; once
blaze-html 0.2 is released and is based on blaze-builder, Stylish won't be
adding any extra dependencies to Hamlet.

I also think that the three forms of interpolation in Hamlet ($$, @@ and ^^)
make equals sense in Stylish: just imagine using url(@myUrl@) and not having
to guess how many parent directories to ascend.


[1] http://github.com/snoyberg/stylish
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100806/a6988d15/attachment.html

More information about the Haskell-Cafe mailing list