Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/groue/GRMustache
Flexible and production-ready Mustache templates for MacOS Cocoa and iOS
https://github.com/groue/GRMustache
Last synced: about 2 months ago
JSON representation
Flexible and production-ready Mustache templates for MacOS Cocoa and iOS
- Host: GitHub
- URL: https://github.com/groue/GRMustache
- Owner: groue
- License: mit
- Created: 2010-11-01T17:47:40.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2022-07-14T11:10:20.000Z (over 2 years ago)
- Last Synced: 2024-10-29T16:59:48.444Z (2 months ago)
- Language: Objective-C
- Homepage: http://mustache.github.com/
- Size: 58.5 MB
- Stars: 1,442
- Watchers: 45
- Forks: 190
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
GRMustache
==========GRMustache is a [Mustache](http://mustache.github.io) template engine written in Objective-C, for both MacOS Cocoa and iOS.
It ships with built-in goodies and extensibility hooks that let you avoid the strict minimalism of the genuine Mustache language when you need it.
**April 22, 2015: GRMustache 7.3.2 is out.** [Release notes](RELEASE_NOTES.md)
Get release announcements and usage tips: follow [@GRMustache on Twitter](http://twitter.com/GRMustache).
System requirements
-------------------GRMustache targets iOS down to version 4.3, MacOS down to 10.6 Snow Leopard (without garbage collection), and only depends on the Foundation framework.
**Swift developers**: You can use GRMustache from Swift, with a limitation: you can only render Objective-C objects. Instead, consider using [GRMustache.swift](https://github.com/groue/GRMustache.swift), a pure Swift implementation of GRMustache.
How To
------### 1. Setup your Xcode project
You have three options, from the simplest to the hairiest:
- [CocoaPods](Guides/installation.md#option-1-cocoapods)
- [Static Library](Guides/installation.md#option-2-static-library)
- [Compile the raw sources](Guides/installation.md#option-3-compiling-the-raw-sources)### 2. Start rendering templates
```objc
#import "GRMustache.h"
```One-liners:
```objc
// Renders "Hello Arthur!"
NSString *rendering = [GRMustacheTemplate renderObject:@{ @"name": @"Arthur" } fromString:@"Hello {{name}}!" error:NULL];
``````objc
// Renders the `Profile.mustache` resource of the main bundle
NSString *rendering = [GRMustacheTemplate renderObject:user fromResource:@"Profile" bundle:nil error:NULL];
```Reuse templates in order to avoid parsing the same template several times:
```objc
GRMustacheTemplate *template = [GRMustacheTemplate templateFromResource:@"Profile" bundle:nil error:nil];
rendering = [template renderObject:arthur error:NULL];
rendering = [template renderObject:barbara error:NULL];
rendering = ...
```Documentation
-------------If you don't know Mustache, start here: http://mustache.github.io/mustache.5.html
- [Guides](Guides/README.md): a guided tour of GRMustache
- [Reference](http://groue.github.io/GRMustache/Reference/): all classes & protocols
- [Troubleshooting](Guides/troubleshooting.md)
- [FAQ](Guides/faq.md)License
-------Released under the [MIT License](LICENSE).
Other Nifty Libraries
---------------------- [groue/GRMustache.swift](http://github.com/groue/GRMustache.swift): Flexible Mustache templates for Swift 1.2 and 2.
- [groue/GRDB.swift](http://github.com/groue/GRDB.swift): SQLite toolkit for Swift 2.
- [groue/GRValidation](http://github.com/groue/GRDB.swift): Validation toolkit for Swift 2.