Quick update: I'm including the "Stylish" code in the hamlet package now, and renaming it to "Camlet" (CSS-hamlet). I'm also including something called "Jamlet", which doesn't do much besides variable interpolation. As you might guess, it's for Javascript. I mention it at the end of my most recent blog post[1].

Michael

[1] http://www.snoyman.com/blog/entry/typesafe-runtime-hamlet/

On Fri, Aug 6, 2010 at 1:25 PM, Michael Snoyman <michael@snoyman.com> wrote:


On Fri, Aug 6, 2010 at 12:28 PM, Benedict Eastaugh <ionfish@gmail.com> wrote:
On 6 August 2010 09:19, Michael Snoyman <michael@snoyman.com> wrote:

> 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
> quasi-quotation:
>
> * 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".

This sounds pretty interesting. I wrote a Ruby tool called Stylish [1]
a couple of years ago to solve a similar set of problems, and have
occasionally wondered about rewriting it in Haskell. I look forward to
seeing what you come up with.

One potentially useful feature is generating code that requires
browser prefixes (-webkit-border-radius etc.). There's also potential
for generating minified versions of the code, concatenating multiple
stylesheets etc.—it's a lot easier to do this stuff if you can
programmatically manipulate the stylesheet at run-time. Embedding
assets (graphics) as data URIs is another thing; have a look at how
something like Jammit [3] does this.

As far as the border-radius kind of stuff: the approach I'm taking to mixins should make it possible to write a plain old Haskell function to output multiple border-radius statements. I might even include such a mixin in the main package.

Regarding concatenating stylesheets: I believe that would have to be handled at the level *above* Stylish; Yesod, for example, automatically concatenates all style statements added via the addStyle function.

There's also a Firefox and Thunderbird extension [2] called Stylish.
Obviously you're free to call your project whatever you wish; I just
thought I should let you know.

I'm open to naming suggestions. Here's a few other ideas I'd had:

* sasslet: I don't really like too much, but makes clear the connection to Hamlet and Sass.
* csser/cssar: pronounced "Caesar," might give Shakespeare fans something to chuckle at.

As it stands, I'm leaning fairly strongly towards including Stylish in the Hamlet package.

Michael