Added Routes to Main.

No PR right away, I feel this could take a bit more refining.
This commit is contained in:
Etienne Werly 2023-06-19 23:47:41 +02:00
parent ad606b4938
commit aec350eaf9
4 changed files with 30 additions and 7 deletions

View file

@ -10,7 +10,9 @@ import Text.Blaze.Html
import Components
import Core.Compilers
import Core.Render
import Core.Render ( )
import Core.Rules
import Routes
import Utils.FileTree
import Kit.Templates.Index ( indexTemplate )
@ -39,21 +41,21 @@ main = hakyll $ do
>>= compileTemplateItem
>>= makeItem
match "posts/*.md" $ do
match' (Post "*.md") $ do
route $ setExtension "html"
compile
$ pandocCompiler
>>= loadAndApplyTemplate "src/Kit/Templates/Post.hs" defaultContext
. fmap demoteHeaders
create ["index"] $ do
route $ constRoute "index.html"
create ["index.html"] $ do
route idRoute
compile
$ makeItem ""
>>= loadAndApplyTemplate "src/Kit/Templates/Index.hs" defaultContext
create [cssHash] $ do
route $ constRoute "css/default.css"
route $ constRoute . tail . path $ DefaultStylesheet
compile css
match (fromList . map fromFilePath $ assets) $ do

View file

@ -5,10 +5,10 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack
name: etienne-moqueur
version: 0.1.0.0
version: 0.2.0.0
author: etienne
maintainer: etienne@moqueur.chat
copyright: 2022 etienne
copyright: 2023 etienne
license: BSD3
build-type: Simple
extra-source-files:
@ -22,6 +22,7 @@ library
Core.Compilers
Core.Render
Core.Routers
Core.Rules
Core.Writer
Css.Default
Info

13
hie.yaml Normal file
View file

@ -0,0 +1,13 @@
cradle:
stack:
- path: "./src"
component: "etienne-moqueur:lib"
- path: "./app/Main.hs"
component: "etienne-moqueur:exe:etienne-moqueur-exe"
- path: "./app/Paths_etienne_moqueur.hs"
component: "etienne-moqueur:exe:etienne-moqueur-exe"
- path: "./test"
component: "etienne-moqueur:test:etienne-moqueur-test"

7
src/Core/Rules.hs Normal file
View file

@ -0,0 +1,7 @@
module Core.Rules where
import Hakyll
import Routes
match' :: Route -> Rules () -> Rules ()
match' r = match (fromGlob . tail . path $ r)