From: sabadev Date: Tue, 16 Mar 2021 01:27:26 +0000 (-0400) Subject: Added the CSS content type. X-Git-Url: http://sabadev.xyz:4321/?a=commitdiff_plain;h=4e3e6bcb8189049fd2ec575671d4ac019d221587;p=website.git Added the CSS content type. --- diff --git a/package.yaml b/package.yaml index c32794f..0c66009 100644 --- a/package.yaml +++ b/package.yaml @@ -25,6 +25,7 @@ dependencies: - bytestring == 0.10.12.0 - cmark == 0.6 - containers == 0.6.2.1 +- http-media == 0.8.0.0 - lucid == 2.9.12.1 - mtl == 2.2.2 - servant == 0.18.2 @@ -39,6 +40,7 @@ default-extensions: - FlexibleInstances - GADTs - KindSignatures +- MultiParamTypeClasses - OverloadedStrings - StandaloneDeriving - TypeOperators diff --git a/src/CssContentType.hs b/src/CssContentType.hs new file mode 100644 index 0000000..593d285 --- /dev/null +++ b/src/CssContentType.hs @@ -0,0 +1,14 @@ +module CssContentType where + +import Data.Text.Lazy (pack) +import Data.Text.Lazy.Encoding (encodeUtf8) +import Network.HTTP.Media ((//), (/:)) +import Servant + +data CSS + +instance Accept CSS where + contentType _ = "text" // "css" /: ("charset", "utf-8") + +instance (Show a) => MimeRender CSS a where + mimeRender _ val = encodeUtf8 $ pack $ show val