Serve static files from a Yesod app.
This is great for developming your application, but also for a dead-simple deployment. Caching headers are automatically taken care of.
If you are running a proxy server (like Apache or Nginx), you may want to have that server do the static serving instead.
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
urlRenderOverride to redirect requests to this subsite to a
separate domain name.
- newtype Static = Static StaticSettings
- data StaticRoute = StaticRoute [Text] [(Text, Text)]
- static :: FilePath -> IO Static
- staticDevel :: FilePath -> IO Static
- embed :: FilePath -> Q Exp
- staticFiles :: FilePath -> Q [Dec]
- staticFilesList :: FilePath -> [FilePath] -> Q [Dec]
- publicFiles :: FilePath -> Q [Dec]
- base64md5 :: ByteString -> String
Default value of
Static for a given file folder.
Does not have index files or directory listings. Expects static files to *never* change
Static based on embedding file contents in the executable at
Template Haskell helpers
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"] 
staticFiles, but takes an explicit list of files to create
identifiers for. The files are given relative to the static folder. For
example, to get the files "staticjsjquery.js" and
"staticcssnormalize.css", you would use:
staticFilesList "static" ["js/jquery.js"], ["css/normalize.css"]]
This can be useful when you have a very large number of static files, but only need to refer to a few of them from Haskell.
like staticFiles, but doesn't append an etag to the query string This will compile faster, but doesn't achieve as great of caching. The browser can avoid downloading the file, but it always needs to send a request with the etag value or the last-modified value to the server to see if its copy is up to dat