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>

Features:

  * 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.

Example:

    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>


Greets,
Ertugrul

-- 
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.

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to