Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.

issues with Mustache template engine #150

Open
BlackScorp opened this issue Jul 31, 2014 · 4 comments
Open

issues with Mustache template engine #150

BlackScorp opened this issue Jul 31, 2014 · 4 comments

Comments

@BlackScorp
Copy link

Hello guys i like the mustache template engine but i cannot use it with piecrust.

  1. Problem when i enable mustache as template engine, Piecrust still search for .html files
    i gues it could be fixed when i add here the template engine default extension https://github.com/ludovicchabant/PieCrust/blob/master/src/PieCrust/Page/PageRenderer.php#L61 instead of .html

  2. i cannot use partials
    {{>header}}
    {{{content}}}
    {{>footer}}

only content is displayed. i think the Problem is on this place

https://github.com/ludovicchabant/PieCrust/blob/master/src/PieCrust/TemplateEngines/MustacheTemplateEngine.php#L65

mustache is not configured at all, the engine does not know anything about template paths or cache folder etc

@ludovicchabant
Copy link
Owner

Hi there!

Sorry you're having trouble... to be fair, I haven't used Mustache templates in years, and I'm pretty sure nobody else has either :) So yeah, it's possible it's just broken. Some comments:

  1. PieCrust 2.0 is going to be better on that front, but for now it's by design. If you specify layout: blah in your page header, PieCrust will only look for layout.html. You would need to specify layout: blah.mustache for PieCrust to look for other extensions.
  2. I probably just haven't tried partials at all :) I'll take a look at your pull request, thanks.

@BlackScorp
Copy link
Author

well no problem iam going to fix this for my needs, PieCrust is at least then one Static Site generater which even support Mustache. My Pullrequest is not working currently, i will make a new one as soon as i fixed the error

@BlackScorp
Copy link
Author

ok my last pullrequest fixed the problems,

right now you can define layout: something.mustache

and something.mustache can have following code

{{>partials/header}}
{{{content}}}
{{>partials/footer}}

and your header.mustache can render all stuffs e.g. {{site.title}} to make it work like twig i have to create Plugins and enable them so you can use things like

{{somelink | prettify }} or if you dont like {{{content}}} (3 braces) as raw output {{content | raw}} could be also added, could you accept the PR as soon as possible? so i can upgraid my version on the server

@ludovicchabant
Copy link
Owner

At last I started looking at the pull requests, but there's a lot of stuff in there, some of it not super clean unfortunately (like for some reason lots of files getting their mod changed?). Also TravisCI says the tests fail on it so I'll have to try it myself... I'll comment over there when I've got some info, thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants