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