yesod-static-1.6.1.0: Static file serving subsite for Yesod Web Framework.

Safe Haskell | Safe-Inferred
Language | Haskell2010

Yesod.EmbeddedStatic.Types

Contents

- Entry

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

data Entry Source #

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

Instances details

Default Entry Source # | When using `def`, you must fill in at least `ebLocation`.
Instance details Defined in Yesod.EmbeddedStatic.Types Methods def :: Entry #

ebHaskellName :: Entry -> Maybe Name Source #

An optional haskell name. If the name is present, a variable of type `Route `EmbeddedStatic`` with the given name will be created which points to this resource.

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 `ByteString``. If the development argument to `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 `[`Text`] -> IO (Maybe (`MimeType`, `ByteString`))`. That is, a function taking as input the list of path pieces and optionally returning a mime type and content.