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

A quick overview of Purescript package managers as of October 2018

Optional elements and properties in Halogen

Simple AJAX in Purescript

Automatically adding (or removing) a prefix to a record 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