The scaffolded site is built as a fully cabalized Haskell package. In addition to source files, config files, templates, and static files are produced as well.
Whether directly using cabal, or indirectly using
yesod devel, building your code will always go through
the cabal file. If you open the file, you’ll see there are both library and executable
blocks. Only one of these is built at a time, depending on the value of the
library-only flag. If
library-only is turned on, then the library is built, which is how yesod devel calls your app. Otherwise, the executable is
library-only flag should only be used by
yesod devel; you should never be explicitly passing it into
cabal. There is an additional flag,
allows cabal to build an executable, but turns on some of the same features as
the library-only flag, i.e., no optimizations and reload versions of the Shakespearean
In general, you will build as follows:
When developing, use yesod devel exclusively.
When building a production build, perform cabal clean && cabal configure && cabal build. This will produce an optimized executable in your dist folder.
In the past we
-fproduction flag. If you produced a scaffolded site in the past,
you may have to use this flag to get a production build.
You’ll also notice that we specify all language extensions in the cabal file. The extensions are specified twice: once for the executable, and once for the library. If you add any extensions ...