mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-28 12:54:07 +03:00
web: fix static file embedding in non-dev builds
This commit is contained in:
parent
8c7eea9ee0
commit
0c73d91f94
@ -55,12 +55,3 @@ getApplicationDev =
|
||||
loader = loadConfig (configSettings Development)
|
||||
{ csParseExtra = parseExtra
|
||||
}
|
||||
|
||||
-- #ifdef PRODUCTION
|
||||
-- putStrLn $ "Production mode, using embedded web files"
|
||||
-- let s = $(embed staticDir)
|
||||
-- #else
|
||||
-- putStrLn $ "Not in production mode, using web files from " ++ staticDir ++ "/"
|
||||
-- s <- staticDevel staticDir
|
||||
-- #endif
|
||||
|
||||
|
@ -12,20 +12,25 @@ This is a separate module to satisfy template haskell requirements.
|
||||
module Hledger.Web.Settings.StaticFiles where
|
||||
|
||||
import Prelude (IO)
|
||||
import System.IO
|
||||
import Yesod.Static
|
||||
import qualified Yesod.Static as Static
|
||||
|
||||
import Prelude
|
||||
import Hledger.Web.Settings (staticDir)
|
||||
|
||||
-- | use this to create your static file serving site
|
||||
staticSite :: IO Static.Static
|
||||
staticSite =
|
||||
staticSite = do
|
||||
#ifdef DEVELOPMENT
|
||||
putStrLn ("using web files from: " ++ staticDir ++ "/") >> hFlush stdout
|
||||
Static.staticDevel staticDir
|
||||
#else
|
||||
Static.static staticDir
|
||||
putStrLn "using embedded web files" >> hFlush stdout
|
||||
return $(Static.embed staticDir)
|
||||
#endif
|
||||
|
||||
|
||||
-- | This generates easy references to files in the static directory at compile time,
|
||||
-- giving you compile-time verification that referenced files exist.
|
||||
-- Warning: any files added to your static directory during run-time can't be
|
||||
|
Loading…
Reference in New Issue
Block a user