{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fno-warn-missing-fields #-}
module Text.Cassius
(
Css
, CssUrl
, ToCss (..)
, renderCss
, renderCssUrl
, cassius
, cassiusFile
, cassiusFileDebug
, cassiusFileReload
, cassiusMixin
, Mixin
, Color (..)
, colorRed
, colorBlack
, mkSize
, AbsoluteUnit (..)
, AbsoluteSize (..)
, absoluteSize
, EmSize (..)
, ExSize (..)
, PercentageSize (..)
, percentageSize
, PixelSize (..)
, cassiusUsedIdentifiers
) where
import Language.Haskell.TH.Quote (QuasiQuoter (..))
import Language.Haskell.TH.Syntax
import Text.IndentToBrace (i2b)
import Text.Internal.Cassius (i2bMixin)
import Text.Internal.Css
import Text.Internal.CssCommon
import Text.Internal.Lucius (parseTopLevels)
import qualified Text.Lucius as Lucius
import Text.Shakespeare (VarType)
import Text.Shakespeare.Base
cassius :: QuasiQuoter
cassius :: QuasiQuoter
cassius = QuasiQuoter :: (String -> Q Exp)
-> (String -> Q Pat)
-> (String -> Q Type)
-> (String -> Q [Dec])
-> QuasiQuoter
QuasiQuoter { quoteExp :: String -> Q Exp
quoteExp = QuasiQuoter -> String -> Q Exp
quoteExp QuasiQuoter
Lucius.lucius (String -> Q Exp) -> (String -> String) -> String -> Q Exp
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> String
i2b }
cassiusFile :: FilePath -> Q Exp
cassiusFile :: String -> Q Exp
cassiusFile String
fp = do
String
contents <- String -> Q String
readFileRecompileQ String
fp
QuasiQuoter -> String -> Q Exp
quoteExp QuasiQuoter
cassius String
contents
cassiusFileDebug :: FilePath -> Q Exp
cassiusFileDebug :: String -> Q Exp
cassiusFileDebug = Bool -> Q Exp -> Parser [TopLevel 'Unresolved] -> String -> Q Exp
cssFileDebug Bool
True [|parseTopLevels Unordered|] (Order -> Parser [TopLevel 'Unresolved]
parseTopLevels Order
Unordered)
cassiusFileReload :: FilePath -> Q Exp
cassiusFileReload :: String -> Q Exp
cassiusFileReload = String -> Q Exp
cassiusFileDebug
cassiusUsedIdentifiers :: String -> [(Deref, VarType)]
cassiusUsedIdentifiers :: String -> [(Deref, VarType)]
cassiusUsedIdentifiers = Bool
-> Parser [TopLevel 'Unresolved] -> String -> [(Deref, VarType)]
cssUsedIdentifiers Bool
True (Order -> Parser [TopLevel 'Unresolved]
parseTopLevels Order
Unordered)
cassiusMixin :: QuasiQuoter
cassiusMixin :: QuasiQuoter
cassiusMixin = QuasiQuoter :: (String -> Q Exp)
-> (String -> Q Pat)
-> (String -> Q Type)
-> (String -> Q [Dec])
-> QuasiQuoter
QuasiQuoter
{ quoteExp :: String -> Q Exp
quoteExp = QuasiQuoter -> String -> Q Exp
quoteExp QuasiQuoter
Lucius.luciusMixin (String -> Q Exp) -> (String -> String) -> String -> Q Exp
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> String
i2bMixin
}