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

Yesod.EmbeddedStatic.Types

Contents

Synopsis

Documentation

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

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

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.

The location to serve the resource from.

The mime type of the resource.

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.

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.

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.