{"id":13879280,"url":"https://github.com/existentialmutt/inline_view_component","last_synced_at":"2025-10-15T09:42:09.846Z","repository":{"id":56877681,"uuid":"307018786","full_name":"existentialmutt/inline_view_component","owner":"existentialmutt","description":"Include template strings in Rails ViewComponent class definitions","archived":false,"fork":false,"pushed_at":"2021-05-02T02:44:27.000Z","size":50,"stargazers_count":22,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-02T20:06:30.262Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/existentialmutt.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2020-10-25T03:45:20.000Z","updated_at":"2025-03-28T10:01:08.000Z","dependencies_parsed_at":"2022-08-20T23:10:10.420Z","dependency_job_id":null,"html_url":"https://github.com/existentialmutt/inline_view_component","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/existentialmutt/inline_view_component","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/existentialmutt%2Finline_view_component","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/existentialmutt%2Finline_view_component/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/existentialmutt%2Finline_view_component/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/existentialmutt%2Finline_view_component/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/existentialmutt","download_url":"https://codeload.github.com/existentialmutt/inline_view_component/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/existentialmutt%2Finline_view_component/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263208051,"owners_count":23430675,"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-08-06T08:02:16.036Z","updated_at":"2025-10-15T09:42:04.813Z","avatar_url":"https://github.com/existentialmutt.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# InlineViewComponent\n\nThis gem allows your ViewComponents to define template strings within the class definition. You should be able to use any templating language your rails app supports (ERB, HAML, Slim...). There's also custom syntax highlighting for heredoc templates for Sublime Text.\n\n## Usage\n\nInclude the `InlineViewComponent` mixin and then specify your template string with `template(string)`. Be sure to delete your component's external template file or ViewComponent will raise an error.\n\n#### Examples\n\n```ruby\nclass ErbComponent \u003c ViewComponent::Base\n  include InlineViewComponent\n\n  def message\n    \"Hello World!\"\n  end\n\n  template \u003c\u003c~ERB\n    \u003cp\u003e \u003c%= message %\u003e \u003c/p\u003e\n  ERB\nend\n```\n\n```ruby\nclass HamlComponent \u003c ViewComponent::Base\n  include InlineViewComponent\n\n  def message\n    \"Hello HAML!\"\n  end\n\n  template \u003c\u003c~HAML, :haml\n    %p= message\n  HAML\nend\n```\n\nYou can provide any template format you have installed as an optional second argument to the template method\n\n```ruby\n  template \u003c\u003c~SLIM, :slim\n    h1 Hello World!\n  SLIM\n```\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'inline_view_component'\n```\n\nAnd then execute:\n\n```bash\n$ bundle\n```\n\nOr install it yourself as:\n\n```bash\n$ gem install inline_view_component\n```\n\n## Syntax Highlighting\n\nSyntax highlighting for Sublime Text is available. Download [this file](/editor/Ruby.sublime-syntax) and add it to your Sublime User package. Then open your ruby files in the `Ruby (Custom)` syntax (or choose `View -\u003e Syntax -\u003e Open All with current extention as...` to use it automatically).\n\nTo get syntax highlighting to work use `ERB`, `HAML`, or `SLIM` as the delimiter for your heredoc string e.g.\n\n```\ntemplate \u003c\u003c~HAML, :haml\n  %h1 A really great template\nHAML\n```\n\n## TODO\n\nThis is an early release. Contributions are welcome!\n\n- [ ] add syntax highlighting for more editors (VS Code, vim, ...)\n\n## Contributing\n\nSend a pull request.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexistentialmutt%2Finline_view_component","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexistentialmutt%2Finline_view_component","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexistentialmutt%2Finline_view_component/lists"}