[scaffold] remove the cryptic dev/prod combinators
This commit is contained in:
parent
27d8f13e7f
commit
78be263e02
@ -33,8 +33,9 @@ makeApplication conf logger = do
|
||||
app <- toWaiAppPlain foundation
|
||||
return $ logWare app
|
||||
where
|
||||
logWare = dev logCallbackDev logCallback (logBS setLogger)
|
||||
setLogger = dev id toProduction logger
|
||||
(logWare, setLogger)
|
||||
| development = (logCallbackDev (logBS setLogger), logger)
|
||||
| production = (logCallback (logBS setLogger), logger)
|
||||
|
||||
makeFoundation :: AppConfig DefaultEnv Extra -> Logger -> IO ~sitearg~
|
||||
makeFoundation conf setLogger = do
|
||||
|
||||
@ -54,8 +54,9 @@ staticRoot conf = [st|#{appRoot conf}/static|]
|
||||
-- user.
|
||||
|
||||
widgetFile :: String -> Q Exp
|
||||
widgetFile = dev Yesod.Default.Util.widgetFileReload
|
||||
Yesod.Default.Util.widgetFileNoReload
|
||||
widgetFile
|
||||
| development = Yesod.Default.Util.widgetFileReload
|
||||
| production = Yesod.Default.Util.widgetFileNoReload
|
||||
|
||||
data Extra = Extra
|
||||
{ extraCopyright :: Text
|
||||
|
||||
@ -10,11 +10,5 @@ development =
|
||||
False
|
||||
#endif
|
||||
|
||||
dev :: a -> a -> a
|
||||
dev a b = if development then a else b
|
||||
|
||||
production :: Bool
|
||||
production = not development
|
||||
|
||||
prod :: a -> a -> a
|
||||
prod a b = if production then a else b
|
||||
|
||||
@ -8,7 +8,9 @@ import Settings.Development
|
||||
|
||||
-- | use this to create your static file serving site
|
||||
staticSite :: IO Static.Static
|
||||
staticSite = dev Static.staticDevel Static.static staticDir
|
||||
staticSite
|
||||
| development = Static.staticDevel staticDir
|
||||
| production = Static.static staticDir
|
||||
|
||||
-- | This generates easy references to files in the static directory at compile time,
|
||||
-- giving you compile-time verification that referenced files exist.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user