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

Safe HaskellNone

Yesod.EmbeddedStatic.Types

Contents

Synopsis

Documentation

type Location = StringSource

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

Default Entry

When using def, you must fill in at least ebLocation.

ebHaskellName :: Entry -> Maybe NameSource

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 -> LocationSource

The location to serve the resource from.

ebMimeType :: Entry -> MimeTypeSource

The mime type of the resource.

ebProductionContent :: Entry -> IO ByteStringSource

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 -> ExpQSource

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 ExpQSource

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.