Monadic Haskell DSL for CSS.
Haskell
Latest commit d51dcdf Sep 27, 2011 @chrisdone Merge pull request #2 from dag/patch-2
-ms-filter not -mz
Permalink
Failed to load latest commit information.
src -ms-filter not -mz Sep 27, 2011
.gitignore First commit. Jun 14, 2011
LICENSE First commit. Jun 14, 2011
README.md Add syntax highlighting to README Sep 25, 2011
Setup.hs First commit. Jun 14, 2011
css.cabal First commit. Jun 14, 2011

README.md

A very simple Haskell DSL for CSS.

Example:

-- | Input style.
inputs :: CSS Rule
inputs =
  rule "form p label" $ do
    rule "textarea" $ do
      width "100%"
      height "20em"
      clear "both"
      margin "1em 0 0 0"

    rule "textarea, input.text" $ do
      border "2px solid #ddd"
      borderRadius "4px"
    rule "textarea:focus, input.text:focus" $ do
      background "#eee"

    rule "span" $ do
      float "left"
      width "7em"
      display "block"

Output:

λ> renderCSS $ runCSS inputs
"form p label
textarea{width:100%;height:20em;clear:both;margin:1em 0 0 0}form p
label textarea, input.text{border:2px solid
#ddd;border-radius:4px}form p label textarea:focus,
input.text:focus{background:#eee}form p label
span{float:left;width:7em;display:block}

Pretty printed:

λ> T.putStrLn $ renderPrettyCSS $ runCSS inputs
form p label{

}
form p label textarea{
    width: 100%;
    height: 20em;
    clear: both;
    margin: 1em 0 0 0
}
form p label textarea, input.text{
    border: 2px solid #ddd;
    border-radius: 4px
}
form p label textarea:focus, input.text:focus{
    background: #eee
}
form p label span{
    float: left;
    width: 7em;
    display: block
}