stitch-0.6.0.0: lightweight CSS DSL

Safe HaskellNone
LanguageHaskell2010

Stitch

Contents

Description

Importing this module should bring enough functions into scope to use the Stitch DSL for most purposes.

Synopsis

Core

type CSS = Stitch () Source #

Abstract representation of a CSS document. This can be transformed to an actual CSS document with renderCSS.

renderCSS :: CSS -> Text Source #

Convert an abstract CSS document to a real CSS document.

newtype Selector Source #

Represents a CSS selector. Can be combined with other Selectors using its Monoid instance.

Constructors

Selector 

Fields

Combinators

(?) :: Monad m => Selector -> StitchT m a -> StitchT m a infixr 6 Source #

Nest a selector under the current selector. For example, this:

"h1" ? do
  "color" .= "red"
  "a" ?
    "text-decoration" .= "underline"

| results in the following being added to the CSS output:

h1 {
  color: red
}
h1 a {
  text-decoration: underline
}

(.=) :: Monad m => Text -> Text -> StitchT m () infix 8 Source #

Add a key-value property pair. For example, "color" .= "red" will add color: red to the CSS output.

comment :: Monad m => Text -> StitchT m () Source #

Add a comment to the CSS output. The compressed printer won't add comments to the final CSS output.