library mustache-js-compiler
Compiles server-side Mustache templates to self-sufficient client-side JS functions
chh/mustache-js-compiler
Compiles server-side Mustache templates to self-sufficient client-side JS functions
- Tuesday, January 21, 2014
- by chh
- Repository
- 1 Watchers
- 0 Stars
- 13 Installations
- PHP
- 1 Dependents
- 1 Suggesters
- 0 Forks
- 0 Open issues
- 2 Versions
- 0 % Grown
MustacheJsCompiler
Compiles server-side Mustache templates to self-sufficient client-side JS functions. Uses the excellent
PhlyMustache., (*1)
Install
composer require 'chh/mustache-js-compiler':~1.0@dev
Usage
The compiler needs an instance of Phly\Mustache\Mustache
to function., (*2)
If you intend to share templates between the server and the client,
than it's recommended to use the same Mustache instance which your
application uses so the template paths are setup the same way (for
partials to be compiled correctly)., (*3)
tokenize()`. It
looks up the template name in the template path, or uses the passed Mustache code. The `compile`
method returns a self-sufficient JavaScript function which executes the template.
The template looks like this:
```mustache
{{! user/show.mustache }}
Hi {{name}}!
```
We can render the template using this code:
```php
Unimplemented Mustache Features
dev-master
9999999-dev
Compiles server-side Mustache templates to self-sufficient client-side JS functions
Sources
Download
MIT
The Requires
The Development Requires
js
mustache
v1.0.0
1.0.0.0
Compiles server-side Mustache templates to self-sufficient client-side JS functions
Sources
Download
MIT
The Requires
The Development Requires
js
mustache