Adding static files to Yesod

In a Yesod app the files in the static folder can be accessed as a variable composed by the folder structure and the name of the file. For example, a file in static/css/main.css will be css_main_css.

If the static folder is modified, the StaticFiles.hs file needs to be recompiled for Yesod to catch up with the changes.

Another solution is to add -fforce-recomp to the ghc-options in the package.yaml file:

  source-dirs: src
  - condition: (flag(dev)) || (flag(library-only))
      - -Wall
      - -fwarn-tabs
      - -O0
      - -fforce-recomp
      cpp-options: -DDEVELOPMENT
      - -Wall
      - -fwarn-tabs
      - -O2

Related Posts

Automatically adding a prefix to a record's labels in Purescript

Planning a simple Reddit clone with Yesod

React-router-dom bindings for Reason

Parsing complex foreign objects in PureScript

A way to deal with big objects and FFI.

Post requests with PureScript Affjax and Argonaut

Simple ajax calls to an API example

Functor, Applicative e Monad illustrati

Una guida chiara

Arbitrary length lists with QuickCheck

Using sized to build arbitrary length lists for QuickCheck

PureScript Impressions

Trying to put some sense in JavaScript

Clojure Examples

Toggling DELL 9350's touchpad on Ubuntu 15.10

How to set up a hotkey to toggle DELL 9350's touchpad on Ubuntu 15.10