I would like to use Shakespearean Templates (Licius + Hamlet + Julius) from the Yesod.But I have some difficulty with this. The following code from enter link description here works:
type TestAPI
= "tests" :> Get '[JSON] [Test]
:<|> "test" :> Get '[JSON] Test
:<|> "TestHTML.html" :> Get '[HTML] Page_TestHTML
serverTestAPI :: ServerT TestAPI AppM
serverTestAPI = tests
:<|> test
:<|> testHtml
data Page_TestHTML = Page_TestHTML
instance ToMarkup Page_TestHTML where
toMarkup Page_TestHTML = builderHtml
testHtml = return Page_TestHTML
builderHtml = [shamlet|
$doctype 5
<html>
<head>
<title>Greeting2
<body>
<h2> Hello world HTML Qqqqq |]
But next code is not working:
data Page_TestHTML_2 = Page_TestHTML_2
instance ToMarkup Page_TestHTML_2 where
toMarkup Page_TestHTML_2 = builderHtml_2
testHtml_2 = return Page_TestHTML_2
builderHtml_2 = do
$(luciusFile "templates/test/TestHTML2.lucius")
$(shamletFile "templates/test/TestHTML2.hamlet")
How I can constructing together Licius + Hamlet + Julius for Servant (without whole Yesod)?
I was able to solve the question. The following code works!
Maybe it will be useful for somebody.