From 5c4e5d989fddd07fd36f3104d688d3b520403004 Mon Sep 17 00:00:00 2001 From: Max Cantor Date: Thu, 5 Jul 2012 09:45:47 -0700 Subject: [PATCH] Added warning about Static embed. Updated to address Felipe's very valid criticisms. --- yesod-static/Yesod/Static.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/yesod-static/Yesod/Static.hs b/yesod-static/Yesod/Static.hs index 3aa274a2..fdc0d683 100644 --- a/yesod-static/Yesod/Static.hs +++ b/yesod-static/Yesod/Static.hs @@ -118,6 +118,13 @@ staticDevel dir = do -- | Produce a 'Static' based on embedding all of the static -- files' contents in the executable at compile time. +-- Nota Bene: if you replace the scaffolded 'static' call in Settings/StaticFiles.hs +-- you will need to change the scaffolded addStaticContent. Otherwise, some of your +-- assets will be 404'ed. This is because by default yesod will generate compile those +-- assets to @static/tmp@ which for 'static' is fine since they are served out of the +-- directory itself. With embedded static, that will not work. +-- You can easily change @addStaticContent@ to @\_ _ _ -> return Nothing@ as a workaround. +-- This will cause yesod to embed those assets into the generated HTML file itself. embed :: Prelude.FilePath -> Q Exp embed fp = [|Static (defaultWebAppSettings