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:

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

Related Posts

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

Using the Asus MB168B+ with Ubuntu 15.10

How to edit the driver install script to make it work on Ubuntu 15.10+ (and other distros)