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

Yesod.Helpers.Static

Contents

Description

Serve static files from a Yesod app.

This is most useful for standalone testing. When running on a production server (like Apache), just let the server do the static serving.

In fact, in an ideal setup you'll serve your static files from a separate domain name to save time on transmitting cookies. In that case, you may wish to use urlRenderOverride to redirect requests to this subsite to a separate domain name.

Synopsis

Subsite

newtype Static Source

Constructors

Static StaticSettings 

Instances

Yesod master => YesodDispatch Static master 

Smart constructor

static :: FilePath -> StaticSource

Default value of Static for a given file folder.

Does not have index files, uses default directory listings and default mime type list.

Template Haskell helpers

staticFiles :: FilePath -> Q [Dec]Source

This piece of Template Haskell will find all of the files in the given directory and create Haskell identifiers for them. For example, if you have the files "static/style.css" and "static/js/script.js", it will essentailly create:

 style_css = StaticRoute ["style.css"] []
 js_script_js = StaticRoute ["js/script.js"] []

Hashing

base64md5 :: ByteString -> StringSource

md5-hashes the given lazy bytestring and returns the hash as base64url-encoded string.

This function returns the first 8 characters of the hash.