Website content for https://pmade.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

site.hs 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. {-# LANGUAGE OverloadedStrings #-}
  2. --------------------------------------------------------------------------------
  3. module Main where
  4. --------------------------------------------------------------------------------
  5. import Hakyll
  6. import Hakyll.Web.JavaScript (jsCreate)
  7. import Hakyll.Web.Sass (scssCompiler)
  8. --------------------------------------------------------------------------------
  9. config :: Configuration
  10. config = defaultConfiguration
  11. { destinationDirectory = "www"
  12. , storeDirectory = ".cache"
  13. , tmpDirectory = ".cache/tmp"
  14. }
  15. --------------------------------------------------------------------------------
  16. main :: IO ()
  17. main = hakyllWith config $ do
  18. -- Main entry point (index.html).
  19. match "index.html" $ do
  20. route idRoute
  21. compile $ do
  22. getResourceBody
  23. >>= loadAndApplyTemplate "templates/main.html" defaultContext
  24. >>= relativizeUrls
  25. -- Remaining markdown files.
  26. match ("contact.md" .||. "labs/**.md") $ do
  27. route $ setExtension "html"
  28. compile $ pandocCompiler
  29. >>= loadAndApplyTemplate "templates/basic.html" defaultContext
  30. >>= relativizeUrls
  31. -- Mash all the JavaScript files into a single file.
  32. jsCreate "assets/javascript/pmade.js" "assets/javascript/*"
  33. -- Stylesheets.
  34. match "assets/stylesheets/*.scss" $ do
  35. route $ setExtension "css"
  36. compile scssCompiler
  37. -- Images.
  38. match "assets/images/**" $ do
  39. route idRoute
  40. compile copyFileCompiler
  41. -- Compile the templates.
  42. match "templates/*.html" $ compile templateCompiler