@@ -85,6 +85,7 @@ data Backend backendRoute frontendRoute = Backend
8585data BackendConfig frontendRoute = BackendConfig
8686 { _backendConfig_runSnap :: ! (Snap () -> IO () ) -- ^ Function to run the snap server
8787 , _backendConfig_staticAssets :: ! StaticAssets -- ^ Static assets
88+ , _backendConfig_frontendGhcjsAssets :: ! StaticAssets -- ^ Compiled GHCJS frontend assets
8889 , _backendConfig_ghcjsWidgets :: ! (GhcjsWidgets (Text -> FrontendWidgetT (R frontendRoute ) () ))
8990 -- ^ Given the URL of all.js, return the widgets which are responsible for
9091 -- loading the script.
@@ -233,7 +234,7 @@ serveGhcjsApp urlEnc ghcjsWidgets app config = \case
233234
234235-- | Default obelisk backend configuration.
235236defaultBackendConfig :: BackendConfig frontendRoute
236- defaultBackendConfig = BackendConfig runSnapWithCommandLineArgs defaultStaticAssets defaultGhcjsWidgets
237+ defaultBackendConfig = BackendConfig runSnapWithCommandLineArgs defaultStaticAssets defaultFrontendGhcjsAssets defaultGhcjsWidgets
237238
238239-- | Run an obelisk backend with the default configuration.
239240runBackend :: Backend backendRoute frontendRoute -> Frontend (R frontendRoute ) -> IO ()
@@ -245,7 +246,7 @@ runBackendWith
245246 -> Backend backendRoute frontendRoute
246247 -> Frontend (R frontendRoute )
247248 -> IO ()
248- runBackendWith (BackendConfig runSnap staticAssets ghcjsWidgets) backend frontend = case checkEncoder $ _backend_routeEncoder backend of
249+ runBackendWith (BackendConfig runSnap staticAssets frontendGhcjsAssets ghcjsWidgets) backend frontend = case checkEncoder $ _backend_routeEncoder backend of
249250 Left e -> fail $ " backend error:\n " <> T. unpack e
250251 Right validFullEncoder -> do
251252 publicConfigs <- getPublicConfigs
@@ -255,11 +256,15 @@ runBackendWith (BackendConfig runSnap staticAssets ghcjsWidgets) backend fronten
255256 Identity r -> case r of
256257 FullRoute_Backend backendRoute :/ a -> serveRoute $ backendRoute :/ a
257258 FullRoute_Frontend obeliskRoute :/ a ->
258- serveDefaultObeliskApp routeToUrl (($ allJsUrl) <$> ghcjsWidgets) (serveStaticAssets staticAssets) frontend publicConfigs $
259+ serveObeliskApp routeToUrl (($ allJsUrl) <$> ghcjsWidgets) (serveStaticAssets staticAssets) frontendApp publicConfigs $
259260 obeliskRoute :/ a
260261 where
261262 routeToUrl (k :/ v) = renderObeliskRoute validFullEncoder $ FullRoute_Frontend (ObeliskRoute_App k) :/ v
262263 allJsUrl = renderAllJsPath validFullEncoder
264+ frontendApp = GhcjsApp
265+ { _ghcjsApp_compiled = frontendGhcjsAssets
266+ , _ghcjsApp_value = frontend
267+ }
263268
264269renderGhcjsFrontend
265270 :: (MonadSnap m , HasCookies m )
0 commit comments