Where do shakespeare splices look for their files

89 views Asked by At

I'm trying to get Shakespeare templates up and running; in particular Text.Hamlet. I have $(shamletFile "HTML/index.hamlet") (See notes) and when I compile the file I get an error telling me the file does not exist. So I have tried various combinations of file paths trying to guess at what working directory is being used by the splice, but without success.

Where do shakespeare splices look for their files? Is this documented somewhere?


NOTES

  1. This path is relative to the source file using the template.
  2. I am not using the full Yesod framework, just the template engine.
1

There are 1 answers

0
Tomasz Lewowski On BEST ANSWER

shamletFile takes a standard FilePath as an argument, and therefore is evaluated against "current local directory". "Current" during Template Haskell evaluation - i.e. compilation phase. As @arrowd pointed out, this is usually main project directory.

Note that if you were using Yesod this would no longer be true, as during the build yesod-bin adds templates/ prefix to each Shakespearean file (and it's hardcoded there).