This is great for developing 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 to use urlRenderOverride
to redirect requests to this subsite to a separate domain
name.

Note that this module's static subsite ignores all files and
directories that are hidden by Unix conventions (i.e. start
with a dot, such as ".ssh") and the directory tmp on the
root of the directory with static files.

Produce a Static based on embedding all of the static
files' contents in the executable at compile time.
Nota Bene: if you replace the scaffolded static call in Settings/StaticFiles.hs
you will need to change the scaffolded addStaticContent. Otherwise, some of your
assets will be 404'ed. This is because by default yesod will generate compile those
assets to static/tmp which for static is fine since they are served out of the
directory itself. With embedded static, that will not work.
You can easily change addStaticContent to _ _ _ -> return Nothing as a workaround.
This will cause yesod to embed those assets into the generated HTML file itself.

Combining CSS/JS

A common scenario on a site is the desire to include many external CSS and
Javascript files on every page. Doing so via the Widget functionality in
Yesod will work, but would also mean that the same content will be
downloaded many times. A better approach would be to combine all of these
files together into a single static file and serve that as a static resource
for every page. That resource can be cached on the client, and bandwidth
usage reduced.

This could be done as a manual process, but that becomes tedious. Instead,
you can use some Template Haskell code which will combine these files into a
single static file at compile time.

Same as staticFiles, but takes an explicit list of files
to create identifiers for. The files path given are relative
to the static folder. For example, to create routes for the
files "static/js/jquery.js" and
"static/css/normalize.css", you would use:

Using publicFiles will speed up the compilation, since there
won't be any need for hashing files during compile-time.
However, since the ETag ceases to be part of the URL, the
Static subsite won't be able to set the expire date too far
on the future. Browsers still will be able to cache the
contents, however they'll need send a request to the server to
see if their copy is up-to-date.