[Haskell-cafe] Ann: Cascading 0.1.0, DSL for Cascading Style Sheets

Ertugrul Söylemez es at ertes.de
Thu Jun 20 17:22:11 CEST 2013

Hi there,

I've just released the first version of [cascading], library for
writing/generating Cascading Style Sheets (CSS) in Haskell.  The API
design is inspired by many other projects, including blaze-html, HSP and
Yesod's Lucius.

[cascading]: <http://hackage.haskell.org/package/cascading>


  * Style sheets are monoids and can be MonadWritered.

  * All non-appendix properties of CSS level 2.1 are implemented and
    exposed through a type-safe API.  It's easy enough to set properties
    for which no type-safe API exists.  See the example below.

  * Easy to integrate into all monadic web frameworks, easy to
    interleave stylesheets with framework operations.

  * Builtin support for web-routes.

  * Color space awareness through the colour library.

  * Fully encoding-aware with one caveat:  If you bypass PropValue and
    use ByteStrings as property values directly, then UTF-8 is assumed.


    stylesheet :: (MonadWriter CSS m) => m ()
    stylesheet =
        onAll $ do
            select ["p"] $ do
                margin . Edges $ [zeroLen]
                padding . Edges $ [_Em # 1, _Ex # 2]

            select ["em"] $ do
                fontWeight BolderWeight

            select ["ul", "ol"] . below ["li"] $ do
                borderColor (LeftEdge green)
                borderWidth (LeftEdge ThickWidth)
                vendors $ "borderRadius" $= ("3mm" :: PropValue)

This results in the following stylesheet:

    p { margin: 0;
        padding: 1em 2ex }

    em { font-weight: bolder }

    ul li, ol li {
        border-left-color: #008000;
        border-left-width: thick;
        border-radius: 3mm;
        -moz-border-radius: 3mm;
        -ms-border-radius: 3mm;
        -o-border-radius: 3mm;
        -webkit-border-radius: 3mm

Please visit the [homepage].  Feedback is always welcome.  If you find
bugs, please don't hesitate to [report] them.

[homepage]: <http://hub.darcs.net/ertes/cascading>
[report]:   <http://hub.darcs.net/ertes/cascading/issues>


Not to be or to be and (not to be or to be and (not to be or to be and
(not to be or to be and ... that is the list monad.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130620/fc97aa7c/attachment.pgp>

More information about the Haskell-Cafe mailing list