summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric Stolten <stoltene2@gmail.com>2013-08-28 13:11:44 -0400
committerEric Stolten <stoltene2@gmail.com>2013-08-28 13:11:44 -0400
commit866a282f19592e9ef4f0b6d3bc44be2dd2b3e08c (patch)
tree2a8f19fa5b8f42d75a6ccac9f7e3f101db3ebe21 /src
parentf01b64164954603466f746cfc9412c7cfac3b443 (diff)
downloadhakyll-866a282f19592e9ef4f0b6d3bc44be2dd2b3e08c.tar.gz
* Preview now shows the deprecation message and calls watch.
* Details on how to disable the server in the command description.
Diffstat (limited to 'src')
-rw-r--r--src/Hakyll/Commands.hs17
-rw-r--r--src/Hakyll/Main.hs2
2 files changed, 10 insertions, 9 deletions
diff --git a/src/Hakyll/Commands.hs b/src/Hakyll/Commands.hs
index 0601909..7951f4e 100644
--- a/src/Hakyll/Commands.hs
+++ b/src/Hakyll/Commands.hs
@@ -65,9 +65,13 @@ clean conf = do
-- | Preview the site
preview :: Configuration -> Verbosity -> Rules a -> Int -> IO ()
#ifdef PREVIEW_SERVER
-preview _ _ _ _ = mapM_ putStrLn [ "The preview command has been deprecated."
- , "Use the watch command for recompilation and serving."
- , "You can disable the server with watch --no-server"]
+preview conf verbosity rules port = do
+ deprecatedMessage
+ watch conf verbosity port True rules
+ where
+ deprecatedMessage = mapM_ putStrLn [ "The preview command has been deprecated."
+ , "Use the watch command for recompilation and serving."
+ ]
#else
preview _ _ _ _ = previewServerDisabled
#endif
@@ -87,12 +91,9 @@ watch conf verbosity port runServer rules = do
(_, ruleSet) <- run conf verbosity rules
return $ rulesPattern ruleSet
- server' :: IO ()
- server' = if runServer
- then (server conf port)
- else (return ())
-
loop = threadDelay 100000 >> loop
+
+ server' = if runServer then server conf port else return ()
#else
watch _ _ _ _ _ = watchServerDisabled
#endif
diff --git a/src/Hakyll/Main.hs b/src/Hakyll/Main.hs
index b8e0444..4b30939 100644
--- a/src/Hakyll/Main.hs
+++ b/src/Hakyll/Main.hs
@@ -87,7 +87,7 @@ hakyllArgs = modes
, (Server (verboseFlag def) (portFlag 8000)) &=
help "Start a preview server"
, (Watch (verboseFlag def) (portFlag 8000) (noServerFlag False) &=
- help "Autocompile on changes and start a preview server")
+ help "Autocompile on changes and start a preview server. You can watch and recompile without running a server with --no-server.")
] &= help "Hakyll static site compiler" &= program progName