Copyright | (c) Alexey Seledkov 2022 |
---|---|
License | GPL-3 |
Maintainer | qyutou@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- data Rule
- newtype Css a = Css {}
- data Config = Config {}
- pretty :: Config
- compact :: Config
- renderRule :: Rule -> Text
- renderRuleWith :: Rule -> Config -> Text
- renderRuleWith' :: Rule -> Config -> Builder -> Builder
- renderCss :: Css () -> Text
- renderCssWith :: Css () -> Config -> Text
- putCss :: Css () -> IO ()
- putCssWith :: Css () -> Config -> IO ()
- renderCssToFile :: Css () -> FilePath -> IO ()
- renderCssToFileWith :: Css () -> Config -> FilePath -> IO ()
- (?) :: Text -> Css () -> Css ()
- rule :: Text -> Css () -> Css ()
- (|>) :: Text -> Text -> Css ()
- declaration :: Text -> Text -> Css ()
- getRules :: Css () -> Rule
Types
AST-like CSS Rule representation
Rule !Text !Rule !Rule | Rule: selector, inner rules/declarations, next |
Declaration !Text !Text !Rule | Declaration: property, value, next |
Leaf !Text | Leaf: text This is used to allow creating the declarations without using of functions |
Empty | Empty |
Css monad - newtype wrapper around Control.Monad.Writer.Writer monad
Instances
Applicative Css Source # | |
Functor Css Source # | |
Monad Css Source # | |
MonadWriter Rule Css Source # | MonadWriter instance for the Css monad |
IsString (Css ()) Source # | IsString instance used to allow the creation of declarations NOTE: This is only for creating the Declarations, it doesn't do anything else. |
Defined in Css.Internal fromString :: String -> Css () # | |
Monoid (Css ()) Source # | Monoid instance for the Css monad |
Semigroup (Css ()) Source # | Semigroup instance for the Css monad |
Show (Css ()) Source # | Show instance for the Css monad |
Rendering
Rendering configuration
Used to render the Css Rules with pretty config
Render the Css Rules with certain configuration
Helper function for render rules Actually this is the main rendering functions, while the rest of the functions are something like front-end
Render the Css Monad with pretty config as Text
Render the Css Monad with certain config as Text
Render the Css Monad and print it to stdout
Render the CSS with certain configuration and print it to stdout
Render the Css Monad and save it to the filePath
Render the Css Monad with certain config and save it to the filepath
eDSL
Create new rule
Examples
>>>
rule "body" (background "#000000") <> rule ".wrapper" (width "90vw" <> maxWidth "72rem")
body { background: #000000; } .wrapper { width: 90vw; max-width: 72rem; }
Create new declaration
Examples
>>>
declaration "width" "90vw"
width: 90vw;