on master help sign in
Add note about `copyFileCompiler` in the tutorial
commit9d42e54119ac22915f371597ebd9247a644a605a authorJasper Van der Jeugt <jaspervdj@gmail.com> dateMon 11 Apr 2011, 09:07 (16 years ago) parent361b81a
1 file changed+16
examples/hakyll/tutorial.markdown+16
examples/hakyll/tutorial.markdown+16
@@ -69,6 +69,10 @@ main = hakyll $ do
6969 route idRoute
7070 compile compressCssCompiler
7171
72+ match "images/*" $ do
73+ route idRoute
74+ compile copyFileCompiler
75+
7276 match "templates/*" $ compile templateCompiler
7377
7478 forM_ ["about.rst", "index.markdown", "code.lhs"] $ \page ->
@@ -148,6 +152,18 @@ the CSS found in the files.
148152compile compressCssCompiler
149153~~~~~
150154
155+We can compile our images in a similar way. We use `idRoute` again, but we don't
156+want to change anything -- so we use `copyFileCompiler`. The difference between
157+most other compilers and `copyFileCompiler` is that the lattern will *not*
158+attempt to read the file: it will copy the file directly, so it supports large
159+binary files as well.
160+
161+~~~~~{.haskell}
162+match "images/*" $ do
163+ route idRoute
164+ compile copyFileCompiler
165+~~~~~
166+
151167Next, we're going to render some pages. We're going to style the results a
152168little, so we're going to need a [Template]. We simply compile a template using
153169the `templateCompiler` compiler, it's good enough in most cases.