{"id":23082524,"url":"https://github.com/lukeclancy/haml2phlex","last_synced_at":"2025-04-03T14:23:41.424Z","repository":{"id":65949014,"uuid":"603204074","full_name":"LukeClancy/haml2phlex","owner":"LukeClancy","description":"imperfect but pretty good haml -\u003e phlex converter for ruby.","archived":false,"fork":false,"pushed_at":"2023-02-23T00:21:37.000Z","size":19269,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-10T08:43:12.657Z","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/LukeClancy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-17T20:57:34.000Z","updated_at":"2023-03-30T07:39:49.000Z","dependencies_parsed_at":"2024-12-16T14:54:41.728Z","dependency_job_id":"22088cc9-432f-47bf-9093-26b58bd29cbd","html_url":"https://github.com/LukeClancy/haml2phlex","commit_stats":{"total_commits":23,"total_committers":1,"mean_commits":23.0,"dds":0.0,"last_synced_commit":"09aa575793cde608cf9de297db4e908bb7d88214"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LukeClancy%2Fhaml2phlex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LukeClancy%2Fhaml2phlex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LukeClancy%2Fhaml2phlex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LukeClancy%2Fhaml2phlex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LukeClancy","download_url":"https://codeload.github.com/LukeClancy/haml2phlex/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247015161,"owners_count":20869505,"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-12-16T14:54:25.956Z","updated_at":"2025-04-03T14:23:41.369Z","avatar_url":"https://github.com/LukeClancy.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Haml2phlex\n\nA haml 2 phlex converter. haml and phlex are both used to render ruby views. See [phlex here](https://phlex.fun)\n\n## Why Phlex?\n- less context switching between haml and ruby leads to easier onboarding and developer happiness\n- Much faster times as the ruby code gets JIT compiled\n- Less files that are more meaningful and organized through splitting the html components into functions.\n- Able to utilize Object Oriented Programming. When you need it, you need it.\n\n## Installation\n\nAdd this to your application's Gemfile:\n\n```ruby\ngroup :development do\n    gem 'haml2phlex'\nend\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install haml2phlex\n\n## Usage\n\nconvert from HAML to Phlex.\n\nthis is an imperfect string-parsing-based converter from HAML to Phlex on a subset of HAML functionality\nmost commonly used.\n\nthis means results still need to be touched up before they are actually usable. However - this will get\nrid of most the grunt work.\n\nuse as so in the rails console to output to the command line so you can copy paste:\n```ruby\nx = Haml2phlex::Haml2flex.new('user_customizes/_show.html.haml', spacer: \"\\t\", base_root: \"app/views/\")\nputs x.out\n```\n\nor to output to a corresponding file with class definitions etc. (in this case app/views/user_customizes/show.rb)\n```ruby\nx = Haml2phlex::Haml2flex.new('user_customizes/_show.html.haml', spacer: \"\\t\", base_root: \"app/views/\")\nx.to_file\n```\n\n## Example Input\n\n```haml\n = form_for @user_customize do |f|\n \t- if @user_customize.errors.any?\n \t\t#error_explanation\n \t\t\t%h2= \"#{pluralize(@user_customize.errors.count, \"error\")} prohibited this user_customize from being saved:\"\n \t\t\t%ul\n \t\t\t\t- @user_customize.errors.full_messages.each do |message|\n \t\t\t\t\t%li= message\n\n \t.actions\n \t\t= f.submit 'Save'\n```\n## Example Output\n\n```ruby\nform_for @user_customize do |f|\n    if @user_customize.errors.any?\n    \tdiv(:id=\u003e\"error_explanation\") {\n\t\t\th2() { \"#{pluralize(@user_customize.errors.count, \"error\")} prohibited this user_customize from being saved:\" } \n\t\t\tul() {\n\t\t\t\t@user_customize.errors.full_messages.each do |message|\n\t\t\t\t\tli() { message } \n\t\t\t\tend\n\t\t\t}\n\t\t}\n\tend\n\tdiv(:class=\u003e\"actions\") {\n\t\tf.submit 'Save'\n\t}\nend\n```\n\n## Options\n\nsince 1.0.13 if you have a template method in your ApplicationView, the to_file function will acommidate that with a super do .... end.\nThis lets you do something like the below in your ApplicationView.\n\n```ruby\ndef template(\u0026)\n\tt = Time.now \n\tyield\n\tRails.logger.info \"#{self.class.to_s} Phlex class took #{(Time.now - t) * 1000} ms\"\nend\n```\nNeedless to say, this is nice for comparing timing with previous haml implementations\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/LukeClancy/haml2flex. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/LukeClancy/haml2flex/blob/master/CODE_OF_CONDUCT.md).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the Haml2flex project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/LukeClancy/haml2flex/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukeclancy%2Fhaml2phlex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukeclancy%2Fhaml2phlex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukeclancy%2Fhaml2phlex/lists"}