{"id":19010305,"url":"https://github.com/railsware/sht_rails","last_synced_at":"2025-06-28T23:33:42.082Z","repository":{"id":3336969,"uuid":"4381088","full_name":"railsware/sht_rails","owner":"railsware","description":"Shared handlebars templates for Rails 3","archived":false,"fork":false,"pushed_at":"2016-04-30T08:57:09.000Z","size":68,"stargazers_count":76,"open_issues_count":4,"forks_count":21,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-12-11T10:37:09.784Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://blog.railsware.com/2012/05/21/shared-handlebars-templates-for-rails-3/","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/railsware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-05-19T21:36:59.000Z","updated_at":"2023-08-31T18:51:10.000Z","dependencies_parsed_at":"2022-09-07T17:10:26.615Z","dependency_job_id":null,"html_url":"https://github.com/railsware/sht_rails","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsware%2Fsht_rails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsware%2Fsht_rails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsware%2Fsht_rails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsware%2Fsht_rails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/railsware","download_url":"https://codeload.github.com/railsware/sht_rails/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230415317,"owners_count":18222158,"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":[],"created_at":"2024-11-08T19:10:47.959Z","updated_at":"2024-12-19T10:08:47.440Z","avatar_url":"https://github.com/railsware.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ShtRails\n\nShared handlebars templates for rails 3 and 4.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'sht_rails'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install sht_rails\n\n## Usage\n\n    $ rails g sht_rails:install\n\nGenerator add into \"application.js\" requirements for mustache and \"templates\" folder in \"app\". Next you can create handlebars templates in this folder or subfolders.\n\nFor example:\n\nFile: \"app/templates/tests/_test.handlebars\"\n\n    Hello {{msg}}!!!\n\nIn view you can render this template by this way:\n\n    \u003c%= render \"tests/test\", :handlebars =\u003e {msg: \"Test\"} %\u003e\n\nThe same template you can render in JavaScript:\n\n    var content = SHT['tests/test']({msg: \"Test\"});\n\n## Configuration\n\n    ShtRails.configure do |config|\n      config.template_extension = 'handlebars' # change extension of mustache templates\n      config.action_view_key    = 'handlebars' # change name of key for rendering in ActionView mustache template\n      config.template_namespace = 'SHT'      # change templates namespace in javascript\n      config.template_base_path = Rails.root.join(\"app\", \"templates\") # templates dir\n    end\n\n### Note on precompiling assets and custom configs\n\nIn Rails, if you have config.assets.initialize\\_on\\_precompile set to false, but have placed the above config in an initializer, it will not run. To get around this, you can do the following in application.rb:\n\n    if \"assets\" == ENV[\"RAILS_GROUPS\"] || [\"development\", \"test\"].include?(ENV[\"RAILS_ENV\"])\n      ShtRails.template_namespace = 'JST'\n    end\n\n\n## Demo\n\nSite: [http://st-rails-example.herokuapp.com](http://st-rails-example.herokuapp.com)\n\nSource code: [https://github.com/le0pard/st_rails_example](https://github.com/le0pard/st_rails_example)\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Added some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frailsware%2Fsht_rails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frailsware%2Fsht_rails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frailsware%2Fsht_rails/lists"}