From a629408254d17dc367f94c08502cef8178d05356 Mon Sep 17 00:00:00 2001 From: markri Date: Thu, 10 Jul 2014 10:47:32 +0200 Subject: [PATCH 1/3] Update composer.json Directory must match namespace in order to get right autloading --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index b99b210..843a8e9 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "mustache/mustache": "~2.5" }, "autoload": { - "psr-0": { "Bobthecow\\Bundle\\BobthecowMustacheBundle": "" } + "psr-0": { "Bobthecow\\Bundle\\MustacheBundle": "" } }, - "target-dir": "Bobthecow/Bundle/BobthecowMustacheBundle" + "target-dir": "Bobthecow/Bundle/MustacheBundle" } From 6d3ef078100901c0137cc1dcafd807caacb7baab Mon Sep 17 00:00:00 2001 From: "M. de Krijger" Date: Thu, 10 Jul 2014 11:38:30 +0200 Subject: [PATCH 2/3] Fixed string cast, and use right variable for template --- CacheWarmer/TemplateCacheCacheWarmer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CacheWarmer/TemplateCacheCacheWarmer.php b/CacheWarmer/TemplateCacheCacheWarmer.php index 3fa2c74..41bf18e 100644 --- a/CacheWarmer/TemplateCacheCacheWarmer.php +++ b/CacheWarmer/TemplateCacheCacheWarmer.php @@ -57,7 +57,7 @@ public function warmUp($cacheDir) } try { - $mustache->loadTemplate($mustache); + $mustache->loadTemplate((string) $template); } catch (\Exception $e) { // problem during compilation, give up } From 08f73c7585783a17617fe5d90eca9fc9db2c92bd Mon Sep 17 00:00:00 2001 From: "M. de Krijger" Date: Thu, 10 Jul 2014 12:11:08 +0200 Subject: [PATCH 3/3] Added README.md --- README.md | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..b9d058b --- /dev/null +++ b/README.md @@ -0,0 +1,55 @@ +MustacheBundle +============== + +A Symfony implementation of the Mustache template rendering. This will add Mustache as a renderer in Symfony + +1) Installing +------------- + +### Composer + +Just run following command with composer: + + composer.phar require bobthecow/mustache-bundle + +Lookup desired version constraint from packagist. After adding this run + + composer.phar update + + +### AppKernel + +To actually download and use this bundle. Also add following line to your `AppKernel.php` + + new Bobthecow\Bundle\MustacheBundle\BobthecowMustacheBundle() + + +### config.yml + +Add rendererer to your config.yml + + framework: + templating: + engines: ['twig', 'mustache'] + + +2) Using it +----------- + +Like you would use twig. Just put your mustache file in your Resources\views folder using `.mustache` as extension. +E.g. + + // Render Mustache template and return response + return $this->render('AcmeDemoBundle:Hello:index.html.mustache'); + +Or pass along the template in the Template() annotation + + /** + * @Template("AcmeDemoBundle:Hello:index.html.mustache") + */ + public function indexAction() + { + return array(); + } + +