Hakyll.Core.UnixFilter

hakyll-4.9.1.0: A static website compiler library

Safe Haskell | None
Language | Haskell98

Hakyll.Core.UnixFilter

Description

A Compiler that supports unix filters.

Synopsis

- unixFilter :: String -> [String] -> String -> Compiler String
- unixFilterLBS :: String -> [String] -> ByteString -> Compiler ByteString

# Documentation

unixFilter #

Arguments

:: String | Program name
-> [String] | Program args
-> String | Program input
-> Compiler String | Program output

Use a unix filter as compiler. For example, we could use the `rev` program as a compiler.

    rev :: Compiler (Item String)
    rev = getResourceString >>= withItemBody (unixFilter "rev" [])

A more realistic example: one can use this to call, for example, the sass compiler on CSS files. More information about sass can be found here:

http://sass-lang.com/

The code is fairly straightforward, given that we use `.scss` for sass:

    match "style.scss" $ do
        route   $ setExtension "css"
        compile $ getResourceString >>=
            withItemBody (unixFilter "sass" ["-s", "--scss"]) >>=
            return . fmap compressCss

unixFilterLBS #

Arguments

:: String | Program name
-> [String] | Program args
-> ByteString | Program input
-> Compiler ByteString | Program output

Variant of `unixFilter` that should be used for binary files

    match "music.wav" $ do
        route   $ setExtension "ogg"
        compile $ getResourceLBS >>= withItemBody (unixFilterLBS "oggenc" ["-"])