Skip to content

Run a sequence of functions on in-memory representations of files.

License

Notifications You must be signed in to change notification settings

icidasset/shikensu-gren

Repository files navigation

Shīkensu

シーケンス Sequence

Run a sequence of functions on in-memory representations of files. Build static websites with ease, without conforming to a specific structure.

Markdown example

import Bytes exposing ( Bytes )
import FileSystem.Path as Path exposing ( Path )
import Shikensu
import Shikensu.Contrib as Shikensu
import Shikensu.Definition as Shikensu
import Task


main : Shikensu.Program
main =
    -- 🚀 List current directory
    Shikensu.program sequence Path.empty


sequence : Shikensu.Task -> Shikensu.Task
sequence task =
    task
        |> Task.map (Shikensu.withExtension "md")
        |> Task.andThen Shikensu.read
        |> Task.map
                (\bundle ->
                    bundle
                        |> Shikensu.renameExtension "md" "html"
                        |> Shikensu.permalink "index"
                        |> Shikensu.renderContent renderMarkdown
                )
        |> Task.andThen (Shikensu.write destination)


destination : Path
destination =
    Path.fromPosixString "./dist"


renderMarkdown : Shikensu.Definition -> Maybe Bytes
renderMarkdown def =
    Maybe.map renderMarkdownBytes def.content

About

Run a sequence of functions on in-memory representations of files.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages