module Slick.Mustache
( compileTemplate'
)
where
import Development.Shake
import Text.Mustache
import Text.Mustache.Compile
compileTemplate' :: FilePath -> Action Template
compileTemplate' :: FilePath -> Action Template
compileTemplate' FilePath
fp = do
Partial => [FilePath] -> Action ()
need [FilePath
fp]
Either ParseError Template
result <- forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ FilePath -> IO (Either ParseError Template)
localAutomaticCompile FilePath
fp
case Either ParseError Template
result of
Right Template
templ -> do
Partial => [FilePath] -> Action ()
need (STree -> [FilePath]
getPartials forall b c a. (b -> c) -> (a -> b) -> a -> c
. Template -> STree
ast forall a b. (a -> b) -> a -> b
$ Template
templ)
forall (m :: * -> *) a. Monad m => a -> m a
return Template
templ
Left ParseError
err -> forall (m :: * -> *) a. MonadFail m => FilePath -> m a
fail forall a b. (a -> b) -> a -> b
$ forall a. Show a => a -> FilePath
show ParseError
err