@@ -48,12 +48,11 @@ backend routeEncoder cfg = do
4848
4949 -- Get the web server configuration from the command line
5050 cmdLineConf <- commandLineConfig defaultConfig
51− headHtml <- fmap snd $ renderStatic $ _backendConfig_head cfg
51+ indexHtml <- fmap snd $ renderStatic $ blankLoader $ _backendConfig_head cfg
5252 let httpConf = cmdLineConf
5353 { accessLog = Just $ ConfigIoLog BSC8.putStrLn
5454 , errorLog = Just $ ConfigIoLog BSC8.putStrLn
5555 }
56− appCfg = def & appConfig_initialHead .~ headHtml
5756 let Right routeEncoderValid = checkEncoder routeEncoder --TODO: Report error better
5857 -- Start the web server
5958 httpServe httpConf $ do
@@ -68,23 +67,17 @@ backend routeEncoder cfg = do
6867 Left e -> writeText e
6968 Right r -> case r of
7069 ObeliskRoute_App _ :/ _ -> do
71− (_, index) <- liftIO $ renderStatic blankLoader --TODO: Render to a Builder instead; don't allow IO
72− writeBS $ "<!DOCTYPE html>\n" <> index
70+ writeBS $ "<!DOCTYPE html>\n" <> indexHtml
7371 ObeliskRoute_Resource ResourceRoute_Static :=> Identity pathSegments -> serveAsset "static.assets" "static" $ T.unpack $ T.intercalate "/" pathSegments
7472 ObeliskRoute_Resource ResourceRoute_Ghcjs :=> Identity ghcjsRoute -> case ghcjsRoute of
7573 GhcjsRoute_AllJs :=> Identity () -> serveAsset "frontend.jsexe.assets" "frontend.jsexe" "all.js"
7674 ObeliskRoute_Resource ResourceRoute_JSaddleWarp :=> Identity _ -> error "asdf"
77− -- Start the web server
78− httpServe httpConf $ route
79− [ ("", serveApp "" appCfg)
80− , ("", serveAssets "frontend.jsexe.assets" "frontend.jsexe") --TODO: Can we prevent naming conflicts between frontend.jsexe and static?
81− , ("static", serveAssets "static.assets" "static")
82− ]
8375
84−blankLoader :: DomBuilder t m => m ()
85−blankLoader = el "html" $ do
76+blankLoader :: DomBuilder t m => m () -> m ()
77+blankLoader headHtml = el "html" $ do
8678 el "head" $ do
8779 elAttr "base" ("href" =: "/") blank --TODO: Figure out the base URL from the routes
80+ headHtml
8881 el "body" $ do
8982 --TODO: Hash the all.js path
9083 elAttr "script" ("language" =: "javascript" <> "src" =: "ghcjs/all.js" <> "defer" =: "defer") blank