Skip to content

Instantly share code, notes, and snippets.

@usagi
Created March 21, 2012 13:54
Show Gist options
  • Save usagi/2147061 to your computer and use it in GitHub Desktop.
Save usagi/2147061 to your computer and use it in GitHub Desktop.
#!/usr/bin/runhaskell
\begin{code}
{-# LANGUAGE OverloadedStrings #-}
import Control.Arrow ((>>>))
import Control.Arrow ((>>^))
import Hakyll
import Text.CSS.CleverCSS
import System.IO.Unsafe
main = hakyll $ do
match "favicon.ico" $ do
route idRoute
compile copyFileCompiler
match "images/" $ do
route idRoute
compile copyFileCompiler
match "css/*.css" $ do
route idRoute
compile compressCssCompiler
match "css/*.clevercss" $ do
route $ setExtension "css"
compile $ getResourceString
>>^ cleverCSSFilter
>>^ compressCss
match "templates/*" $ compile templateCompiler
match "*.markdown" $ do
route $ setExtension "html"
compile $ pageCompiler
>>> applyTemplateCompiler "templates/default.html"
>>> relativizeUrlsCompiler
cleverCSSFilter :: String -> String
cleverCSSFilter i =
case (unsafePerformIO $ cleverCSSConvert [] i []) of
Right r -> r
\end{code}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment