[web-devel] Question for y'all: simplifying cassius

Michael Snoyman michael at snoyman.com
Thu Oct 28 06:42:52 CEST 2010

Hey all,

Cassius (the CSS template language that goes along with Hamlet[1]) has
some features which I've never advertised, and frankly never use:

* mixins
* nesting

My question is: will anyone miss them if they're gone? Right now,
neither one of these features is implemented in a good way: mixins
requires a special datatype, a separate quasi-quoter, and don't always
work as expected. Nesting doesn't do what you expect often, eg:

p, div
        color: red


p, div .some-class { color: red }

As a result of having these two features, cassius is overall worse:

* You *must* put a space between the colon and the attribute value.
This has to do with determining if we're nesting and pseudo-classes.
* The error messages are rotten.

I have no doubt that all of these problems could be fixed, given some
time. However, I personally don't actually find that I need these
features, and if no one else is using them right now, I'd rather
release a new version of Hamlet without this extra weight and perhaps
come back to these features in the future.

By the way, if anyone is interested in tackling this stuff, I imagine
the proper way to get it working would involve using an intermediate
datatype that keeps line/column information, and then rendering that
intermediate datatype using blaze. It won't be quite as fast as the
current approach, but I highly doubt Cassius is going to be a
bottleneck in anyone's applications.


[1] http://hackage.haskell.org/package/hamlet

More information about the web-devel mailing list