on master help sign in
* Preview now shows the deprecation message and calls watch.

* Details on how to disable the server in the command description.

commit866a282f19592e9ef4f0b6d3bc44be2dd2b3e08c authorEric Stolten <stoltene2@gmail.com> dateWed 28 Aug 2013, 13:11 (13 years ago) parentf01b641
2 files changed+10−9
src/Hakyll/Commands.hs+9−8 src/Hakyll/Main.hs+1−1
src/Hakyll/Commands.hs+9−8
@@ -65,9 +65,13 @@ clean conf = do
6565-- | Preview the site
6666preview :: Configuration -> Verbosity -> Rules a -> Int -> IO ()
6767#ifdef PREVIEW_SERVER
68−preview _ _ _ _ = mapM_ putStrLn [ "The preview command has been deprecated."
69− , "Use the watch command for recompilation and serving."
70− , "You can disable the server with watch --no-server"]
68+preview conf verbosity rules port = do
69+ deprecatedMessage
70+ watch conf verbosity port True rules
71+ where
72+ deprecatedMessage = mapM_ putStrLn [ "The preview command has been deprecated."
73+ , "Use the watch command for recompilation and serving."
74+ ]
7175#else
7276preview _ _ _ _ = previewServerDisabled
7377#endif
@@ -87,12 +91,9 @@ watch conf verbosity port runServer rules = do
8791 (_, ruleSet) <- run conf verbosity rules
8892 return $ rulesPattern ruleSet
8993
90− server' :: IO ()
91− server' = if runServer
92− then (server conf port)
93− else (return ())
94−
9594 loop = threadDelay 100000 >> loop
95+
96+ server' = if runServer then server conf port else return ()
9697#else
9798watch _ _ _ _ _ = watchServerDisabled
9899#endif
src/Hakyll/Main.hs+1−1
@@ -87,7 +87,7 @@ hakyllArgs = modes
8787 , (Server (verboseFlag def) (portFlag 8000)) &=
8888 help "Start a preview server"
8989 , (Watch (verboseFlag def) (portFlag 8000) (noServerFlag False) &=
90− help "Autocompile on changes and start a preview server")
90+ help "Autocompile on changes and start a preview server. You can watch and recompile without running a server with --no-server.")
9191 ] &= help "Hakyll static site compiler" &= program progName
9292
9393