Skip to content

Commit

Permalink
Merge pull request #5 from markri/master
Browse files Browse the repository at this point in the history
README, bugfix, namespace issue
  • Loading branch information
bobthecow committed Jul 10, 2014
2 parents 6be2574 + 08f73c7 commit 6aff7b6
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CacheWarmer/TemplateCacheCacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function warmUp($cacheDir)
}

try {
$mustache->loadTemplate($mustache);
$mustache->loadTemplate((string) $template);
} catch (\Exception $e) {
// problem during compilation, give up
}
Expand Down
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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();
}


4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit 6aff7b6

Please sign in to comment.