{"id":15046260,"url":"https://github.com/gi/tilt-handlebars","last_synced_at":"2025-09-30T06:30:39.645Z","repository":{"id":9357083,"uuid":"11209919","full_name":"gi/tilt-handlebars","owner":"gi","description":"A Tilt interface to the official JavaScript version of Handlebars.","archived":false,"fork":false,"pushed_at":"2022-02-03T08:53:54.000Z","size":85,"stargazers_count":16,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2025-01-16T21:50:18.446Z","etag":null,"topics":["handlebars","ruby","tilt"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-05T23:07:02.000Z","updated_at":"2024-12-16T07:03:27.000Z","dependencies_parsed_at":"2022-07-06T14:32:14.350Z","dependency_job_id":null,"html_url":"https://github.com/gi/tilt-handlebars","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gi%2Ftilt-handlebars","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gi%2Ftilt-handlebars/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gi%2Ftilt-handlebars/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gi%2Ftilt-handlebars/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gi","download_url":"https://codeload.github.com/gi/tilt-handlebars/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234710411,"owners_count":18875187,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["handlebars","ruby","tilt"],"created_at":"2024-09-24T20:52:55.628Z","updated_at":"2025-09-30T06:30:39.277Z","avatar_url":"https://github.com/gi.png","language":"Ruby","readme":"# Tilt::Handlebars\n\n[![Gem Version](https://badge.fury.io/rb/tilt-handlebars.svg)](https://rubygems.org/gems/tilt-handlebars)\n[![Build Status](https://github.com/gi/tilt-handlebars/actions/workflows/ci.yml/badge.svg)](https://github.com/gi/tilt-handlebars/actions/workflows/ci.yml)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/19d544fcb843a50db1a2/test_coverage)](https://codeclimate.com/github/gi/tilt-handlebars/test_coverage)\n[![Maintainability](https://api.codeclimate.com/v1/badges/19d544fcb843a50db1a2/maintainability)](https://codeclimate.com/github/gi/tilt-handlebars/maintainability)\n[![MIT License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE.txt)\n\nA [Tilt](https://github.com/rtomayko/tilt) interface for the official JavaScript\nimplementation of the [Handlebars.js](https://handlebarsjs.com) template engine.\n\n[Handlebars::Engine](https://github.com/gi/handlebars-ruby) provides the API\nwrapper. [MiniRacer](https://github.com/rubyjs/mini_racer) provides the\nJavaScript execution environment.\n\nSee [Handlebars.js](http://handlebarsjs.com) for template syntax.\n\nSee [Handlebars::Engine](https://github.com/gi/handlebars-ruby) for API syntax.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'tilt-handlebars'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install tilt-handlebars\n\n## Usage\n\nCreate a Handlebars template file with either a `.hbs` or `.handlebars` extension.\n\nExample, in `hello.hbs`:\n\n```\nHello, {{name}}. I'm {{emotion}} to meet you.\n```\n\nThen, render the template with Ruby:\n\n```ruby\nrequire 'tilt/handlebars'\n\ntemplate = Tilt.new('hello.hbs')\nputs template.render(nil, name: \"Joe\", emotion: \"happy\")\n```\n\nOutput:\n\n\tHello, Joe. I'm happy to meet you.\n\n### Partials\n\nPartials are a file that can be loaded into another. For example, you may define a web page with\na master layout (`layout.hbs`), which includes a header (`header.hbs`) and footer (`footer.hbs`).\nIn this case, `header.hbs` and `footer.hbs` would be partials; `layout.hbs` includes these partials.\n\n`layout.hbs`:\n\n```html\n\u003chtml\u003e\n\t\u003chead\u003e...\u003c/head\u003e\n\t\u003cbody\u003e\n\t\t{{\u003e header }}\n\n\t\t{{ content }}\n\n\t\t{{\u003e footer }}\n\t\u003c/body\u003e\n\u003c/html\u003e\n```\n\nNotice that you do not include the `.hbs` file extension in the partial name. Tilt Handlebars\nwill look for the partial relative to the enclosing file (`layout.hbs` in this example) with\neither a `.hbs` or `.handlebars` extension.\n\n#### Sinatra\n\nHandlebars can be used with Sintra:\n\n```ruby\nrequire 'sinatra/handlebars'\n\nclass MyApp \u003c Sinatra::Base\n  helpers Sinatra::Handlebars\n\n  get \"/hello\" do\n    handlebars :hello, locals: {name: 'Joe'}\n  end\nend\n```\n\nThis will use the template file named `views/hello.hbs`.\n\nPartials can also be used with Sinatra. As described previously, partials will be loaded\nrelative to the enclosing template (e.g., in the `views` directory).\n\n## Changelog\n\nSee [RELEASE_NOTES.md](RELEASE_NOTES.md) for more details.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub:\nhttps://github.com/gi/tilt-handlebars.\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for more details.\n\n## License\n\nThe gem is available as open source under the terms of the\n[MIT License](https://opensource.org/licenses/MIT).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgi%2Ftilt-handlebars","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgi%2Ftilt-handlebars","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgi%2Ftilt-handlebars/lists"}