{"id":31740335,"url":"https://github.com/combinaut/minibars","last_synced_at":"2025-10-09T10:18:03.019Z","repository":{"id":44717284,"uuid":"433168111","full_name":"combinaut/minibars","owner":"combinaut","description":"A (mostly) drop-in replacement for Handlebars.rb based on MiniRacer rather than therubyracer.","archived":false,"fork":false,"pushed_at":"2024-03-05T17:39:18.000Z","size":74,"stargazers_count":8,"open_issues_count":0,"forks_count":4,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-09-06T20:04:44.678Z","etag":null,"topics":["handlebars","miniracer","rails","ruby","therubyracer"],"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/combinaut.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-29T19:18:20.000Z","updated_at":"2023-11-08T02:50:10.000Z","dependencies_parsed_at":"2022-09-17T15:40:44.522Z","dependency_job_id":null,"html_url":"https://github.com/combinaut/minibars","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/combinaut/minibars","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/combinaut%2Fminibars","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/combinaut%2Fminibars/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/combinaut%2Fminibars/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/combinaut%2Fminibars/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/combinaut","download_url":"https://codeload.github.com/combinaut/minibars/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/combinaut%2Fminibars/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278861038,"owners_count":26058633,"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","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","miniracer","rails","ruby","therubyracer"],"created_at":"2025-10-09T10:18:02.108Z","updated_at":"2025-10-09T10:18:03.011Z","avatar_url":"https://github.com/combinaut.png","language":"Ruby","readme":"![Tests](https://github.com/delonnewman/minibars/workflows/tests/badge.svg)\n\n# Minibars\n\nA (mostly) drop-in replacement for [Handlebars.rb][3] based on [MiniRacer][1] rather than [therubyracer][2].\n\nAn appropriately revised quote from the [Handlebars.rb][3] README:\n\n\u003e This uses ~~therubyracer~~[MiniRacer][1] to bind to the _actual_ JavaScript implementation of [Handlebars.js](https://github.com/handlebars-lang/handlebars.js) so that you can use it from ruby.\n\n# Why?\n\nMinibars is a stripped down implementation of [Handlerbars.rb][3] using [MiniRacer][1]. It eschews capabilities that require two-way binding with the JS runtime, making it a good choice for those with simple Handlebars templates who need an upgrade path for their ARM64 architecture.\n\n# Usage\n\n## Simple Stuff\n\n```ruby\nrequire 'minibars'\nminibars = Minibars::Context.new\ntemplate = minibars.compile(\"{{say}} {{what}}\")\ntemplate.call(say: \"Hey\", what: \"Yuh!\") #=\u003e \"Hey Yuh!\"\n```\n\n## Functions as Properties\n\nThis feature differs from [Handlebars.rb][3] since Minibars templates won't pass a `this` argument to property functions.\n\n```ruby\ntemplate.call(say: \"Hey \", what: -\u003e{ (\"yo\" * 2) + \"!\"}) #=\u003e \"Hey yoyo!\"\n```\n\n## Helpers\n\nJavaScript helpers can be loaded as individual files or as a glob\n\n```ruby\nminibars.load_helpers(\"#{__dir__}/javascripts/helpers/**/*.js\")\nminibars.load_helper(\"#{__dir__}/javascripts/helpers/admin.js\")\n```\n\n## Partials\n\nYou can directly register partials\n\n```ruby\nminibars.register_partial(\"whoami\", \"I am {{who}}\")\nminibars.compile(\"{{\u003ewhoami}}\").call(who: 'Legend') #=\u003e I am Legend\n```\n\n## SafeStrings\n\nBy default, handlebars will escape strings that are returned by your block helpers. To mark a string as safe:\n\n```ruby\ntemplate = minibars.compile(\"{{safe}}\")\ntemplate.call(safe: Minibars::SafeString.new(\"\u003cpre\u003eTotally Safe!\u003cpre\u003e\"))\n```\n\n## Compatibility\n\n`Handlebars::Context` aliases `Minibars::Context` and `Handlebars::SafeString` aliases `Minibars::SafeString` unless they are already defined.\n\n```ruby\nrequire 'handlebars` # Applies the compatibility layer found in lib/handlebars.rb and loads minibars\n```\n\n## Limitations\n\n- No Ruby helpers\n\n## Security\n\nIn general, you should not trust user-provided templates: a template can call any method (with no arguments) or access any property on any object in the `Minibars::Context`.\n\nIf you'd like to render user-provided templates, you'd want to make sure you do so in a sanitized Context, e.g. no filesystem access, read-only or no database access, etc.\n\n[1]: https://github.com/rubyjs/mini_racer\n[2]: https://github.com/rubyjs/therubyracer\n[3]: https://github.com/cowboyd/handlebars.rb\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcombinaut%2Fminibars","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcombinaut%2Fminibars","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcombinaut%2Fminibars/lists"}