Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Integrating Hastache templates into Scotty
Haskell
branch: master

Merge pull request #3 from yamadapc/master

Fix the example in the README
latest commit d3cf5de1c5
@co-dan co-dan authored

README.md

scotty-hastache

Integrating Hastache into Scotty

{-# LANGUAGE OverloadedStrings #-}
module Main where

import Text.Hastache
import Web.Scotty.Trans as S
import Web.Scotty.Hastache

main :: IO ()
main = scottyH' 3000 $ do
  setTemplatesDir "templates"
  -- ^ Setting up the director with templates
  get "/:word" $ do
    beam <- param "word"
    setH "action" $ MuVariable (beam :: String)
    -- ^ "action" will be binded to the contents of 'beam'
    hastache "greet.html"

templates/greet.html:

<h1>Scotty, {{action}} me up!</h1>

Installation

  1. Install GHC, Haskell platform, etc.
  2. Use cabal-install to automatically pull all the dependencies and install the library:
cabal update
cabal install scotty-hastache

Examples

Something went wrong with that request. Please try again.