Safe Haskell | None |
---|---|
Language | Haskell98 |
Yesod.EmbeddedStatic.Types
Contents
Synopsis
- type Location = String
- type Generator = Q [Entry]
- data Entry
- ebHaskellName :: Entry -> Maybe Name
- ebLocation :: Entry -> Location
- ebMimeType :: Entry -> MimeType
- ebProductionContent :: Entry -> IO ByteString
- ebDevelReload :: Entry -> ExpQ
- ebDevelExtraFiles :: Entry -> Maybe ExpQ
Documentation
type Location = String Source #
A location is a relative path within the static subsite at which resource(s) are made available. The location can include slashes to simulate directories but must not start or end with a slash.
type Generator = Q [Entry] Source #
An embedded generator is executed at compile time to produce the entries to embed.
Entry
A single resource embedded into the executable at compile time.
This data type is a settings type. For more information, see http://www.yesodweb.com/book/settings-types.
Instances
Default Entry Source # | When using |
Defined in Yesod.EmbeddedStatic.Types |
ebHaskellName :: Entry -> Maybe Name Source #
An optional haskell name. If the name is present, a variable
of type Route
with the
given name will be created which points to this resource.EmbeddedStatic
ebLocation :: Entry -> Location Source #
The location to serve the resource from.
ebMimeType :: Entry -> MimeType Source #
The mime type of the resource.
ebProductionContent :: Entry -> IO ByteString Source #
If the development argument to mkEmbeddedStatic
is False,
then at compile time this action will be executed to load the content.
During development, this action will not be executed.
ebDevelReload :: Entry -> ExpQ Source #
This must be a template haskell expression of type IO
.
If the development argument to ByteString
mkEmbeddedStatic
is True,
this action is executed on every request to compute the content. Most of the
time, ebProductionContent
and ebDevelReload
should be the same action but
occasionally you might want additional processing inside the ebProductionContent
function like javascript/css minification to only happen when building for production.
ebDevelExtraFiles :: Entry -> Maybe ExpQ Source #
Occasionally, during development an entry needs extra files/resources available
that are not present during production (for example, image files that are embedded
into the CSS at production but left unembedded during development). If present,
ebDevelExtraFiles
must be a template haskell expression of type
[
. That is, a function
taking as input the list of path pieces and optionally returning a mime type
and content.Text
] -> IO (Maybe (MimeType
, ByteString
))