Skip to content

Commit 6aff7b6

Browse files
committed
Merge pull request #5 from markri/master
README, bugfix, namespace issue
2 parents 6be2574 + 08f73c7 commit 6aff7b6

File tree

3 files changed

+58
-3
lines changed

3 files changed

+58
-3
lines changed

CacheWarmer/TemplateCacheCacheWarmer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function warmUp($cacheDir)
5757
}
5858

5959
try {
60-
$mustache->loadTemplate($mustache);
60+
$mustache->loadTemplate((string) $template);
6161
} catch (\Exception $e) {
6262
// problem during compilation, give up
6363
}

README.md

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
MustacheBundle
2+
==============
3+
4+
A Symfony implementation of the Mustache template rendering. This will add Mustache as a renderer in Symfony
5+
6+
1) Installing
7+
-------------
8+
9+
### Composer
10+
11+
Just run following command with composer:
12+
13+
composer.phar require bobthecow/mustache-bundle
14+
15+
Lookup desired version constraint from packagist. After adding this run
16+
17+
composer.phar update
18+
19+
20+
### AppKernel
21+
22+
To actually download and use this bundle. Also add following line to your `AppKernel.php`
23+
24+
new Bobthecow\Bundle\MustacheBundle\BobthecowMustacheBundle()
25+
26+
27+
### config.yml
28+
29+
Add rendererer to your config.yml
30+
31+
framework:
32+
templating:
33+
engines: ['twig', 'mustache']
34+
35+
36+
2) Using it
37+
-----------
38+
39+
Like you would use twig. Just put your mustache file in your Resources\views folder using `.mustache` as extension.
40+
E.g.
41+
42+
// Render Mustache template and return response
43+
return $this->render('AcmeDemoBundle:Hello:index.html.mustache');
44+
45+
Or pass along the template in the Template() annotation
46+
47+
/**
48+
* @Template("AcmeDemoBundle:Hello:index.html.mustache")
49+
*/
50+
public function indexAction()
51+
{
52+
return array();
53+
}
54+
55+

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"mustache/mustache": "~2.5"
1818
},
1919
"autoload": {
20-
"psr-0": { "Bobthecow\\Bundle\\BobthecowMustacheBundle": "" }
20+
"psr-0": { "Bobthecow\\Bundle\\MustacheBundle": "" }
2121
},
22-
"target-dir": "Bobthecow/Bundle/BobthecowMustacheBundle"
22+
"target-dir": "Bobthecow/Bundle/MustacheBundle"
2323
}

0 commit comments

Comments
 (0)