Copyright | © 2016–2017 Stack Builders |
---|---|
License | BSD 3 clause |
Maintainer | Mark Karpov <markkarpov92@gmail.com> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Template Haskell helpers to compile Mustache templates at compile time. This module is not imported as part of Text.Mustache, so you need to import it yourself. Qualified import is recommended, but not necessary.
At the moment, functions in this module only work with GHC 8 (they
require at least template-haskell-2.11
).
- compileMustacheDir :: PName -> FilePath -> Q Exp
- compileMustacheFile :: FilePath -> Q Exp
- compileMustacheText :: PName -> Text -> Q Exp
- mustache :: QuasiQuoter
Documentation
:: PName | Which template to select after compiling |
-> FilePath | Directory with templates |
-> Q Exp | The resulting template |
Compile all templates in specified directory and select one. Template
files should have the extension mustache
, (e.g. foo.mustache
) to be
recognized. This function does not scan the directory recursively.
This version compiles the templates at compile time.
Compile single Mustache template and select it.
This version compiles the template at compile time.
mustache :: QuasiQuoter Source #
Compile Mustache using QuasiQuoter. Usage:
{-# LANGUAGE QuasiQuotes #-} import Text.Mustache.Compile.TH (mustache) foo :: Template foo = [mustache|This is my inline {{ template }}.|]
Name of created partial is set to "quasi-quoted"
. You can extend cache
of Template
created this way using (
and so work
with partials as usual.<>
)
Since: 0.1.7