{"id":26879800,"url":"https://github.com/seekingalpha/jst","last_synced_at":"2025-03-31T13:32:57.681Z","repository":{"id":16323414,"uuid":"19072584","full_name":"seekingalpha/jst","owner":"seekingalpha","description":"Simple Javascript templates for Rails projects without Sprockets","archived":false,"fork":false,"pushed_at":"2014-06-18T11:34:26.000Z","size":225,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-04-19T11:07:43.632Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/seekingalpha.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-23T14:25:23.000Z","updated_at":"2014-06-18T11:34:26.000Z","dependencies_parsed_at":"2022-08-04T09:00:21.874Z","dependency_job_id":null,"html_url":"https://github.com/seekingalpha/jst","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seekingalpha%2Fjst","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seekingalpha%2Fjst/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seekingalpha%2Fjst/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seekingalpha%2Fjst/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seekingalpha","download_url":"https://codeload.github.com/seekingalpha/jst/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246474144,"owners_count":20783432,"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":"2025-03-31T13:32:55.168Z","updated_at":"2025-03-31T13:32:57.590Z","avatar_url":"https://github.com/seekingalpha.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Code Climate](https://codeclimate.com/repos/5358f2f0e30ba06766001f0b/badges/4b55d6afc21edbf37bc0/gpa.png)](https://codeclimate.com/repos/5358f2f0e30ba06766001f0b/feed)\n\n[![Build Status](https://travis-ci.org/seekingalpha/jst.svg?branch=master)](https://travis-ci.org/seekingalpha/jst)\n\n\n# JST\n\nJST is a simple javascript templating system inspired by Sprockets' homonimous templating system, but built for rails projects without Sprockets.\n\nJST works on top of [PrototypeJS's template system](http://prototypejs.org/doc/latest/language/Template/) and [HandleBars](http://handlebarsjs.com/).\n\n## Install\n\nAdd this line to your application's Gemfile:\n\n    gem 'jst', github: 'seekingalpha/jst'\n\nAnd then execute:\n\n    $ bundle\n\n## Usage\n\nCreate a folder in your project and add PrototypeJS templates with the \".jst.pt\" extension or Handlebars with the \".jst.hb\". Let's suppose you have a \"hi.jst.pt\" file in \"app/assets/javascripts/templates\":\n\n```html\n  \u003ch1\u003eHi, #{name}\u003c/h1\u003e\n```\nIn order to compile your templates, run:\n\n```ruby\n  JST::Aggregator.new('app/assets/javascripts/templates').save('public/javascripts/templates.js')\n```\n\nIf you don't wanna pass the paths every time, you can configure it first (rule of thumb: add it to config/initializers/jst.rb):\n\n```ruby\n  JST.configure do |config|\n    config.templates_path = 'app/assets/javascripts/templates'\n    config.output         = 'public/javascripts/templates.js'\n  end\n```\n\nThen you can just run:\n\n```ruby\n  JST.process!\n```\n\nNow, load templates.js in your view and then you can use the templates like this in your JS files:\n\n```js\n  Templates.hi({name: 'Emmanuel'})\n```\n\nThis will output ```\u003ch1\u003eHi, Emmanuel\u003c/h1\u003e```, as expected. Notice the method \"hi\" is created automatically based on the name of the template file.\n\nEnjoy!\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 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n\n## Roadmap\n\n- Use guard to watch template folder and compile automatically when changed.\n- ~~Allow handlebars templates.~~\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseekingalpha%2Fjst","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseekingalpha%2Fjst","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseekingalpha%2Fjst/lists"}