{"id":13515396,"url":"https://github.com/kirillplatonov/hotwire-livereload","last_synced_at":"2025-05-14T07:10:52.136Z","repository":{"id":37958133,"uuid":"402716463","full_name":"kirillplatonov/hotwire-livereload","owner":"kirillplatonov","description":"Live reload gem for Hotwire Rails apps.","archived":false,"fork":false,"pushed_at":"2025-01-07T09:28:53.000Z","size":103,"stargazers_count":520,"open_issues_count":5,"forks_count":27,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-11T02:51:45.817Z","etag":null,"topics":["hotwire","livereload","rails","ruby"],"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/kirillplatonov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"MIT-LICENSE","code_of_conduct":null,"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},"funding":{"github":["kirillplatonov"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2021-09-03T09:31:14.000Z","updated_at":"2025-04-07T08:32:54.000Z","dependencies_parsed_at":"2023-11-29T15:29:27.253Z","dependency_job_id":"b0546bf9-9964-4116-a30c-e455944a9ea6","html_url":"https://github.com/kirillplatonov/hotwire-livereload","commit_stats":{"total_commits":80,"total_committers":12,"mean_commits":6.666666666666667,"dds":"0.17500000000000004","last_synced_commit":"4ff247dd3e6b57abe439e240de676a4f48e875e7"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirillplatonov%2Fhotwire-livereload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirillplatonov%2Fhotwire-livereload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirillplatonov%2Fhotwire-livereload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirillplatonov%2Fhotwire-livereload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kirillplatonov","download_url":"https://codeload.github.com/kirillplatonov/hotwire-livereload/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254092798,"owners_count":22013292,"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":["hotwire","livereload","rails","ruby"],"created_at":"2024-08-01T05:01:10.735Z","updated_at":"2025-05-14T07:10:47.123Z","avatar_url":"https://github.com/kirillplatonov.png","language":"JavaScript","funding_links":["https://github.com/sponsors/kirillplatonov"],"categories":["JavaScript"],"sub_categories":[],"readme":"# Hotwire::Livereload\n\nAutomatically reload Hotwire Turbo when app files are modified.\n\nhttps://user-images.githubusercontent.com/839922/148676469-0acfa036-832e-4b40-aa05-1fdd945baa1f.mp4\n\n## Getting started\n\nAdd `hotwire-livereload` to your Gemfile:\n```bash\nbundle add hotwire-livereload --group development\n```\n\nIn your layout, make sure you don't `turbo-track` your JS/CSS in development:\n```diff\n+ \u003c%= stylesheet_link_tag \"application\", \"data-turbo-track\": Rails.env.production? ? \"reload\" : \"\" %\u003e\n- \u003c%= stylesheet_link_tag \"application\", \"data-turbo-track\": \"reload\" %\u003e\n```\n\n## Configuration\n\nFolders watched by default:\n- `app/views`\n- `app/helpers`\n- `app/javascript`\n- `app/assets/stylesheets`\n- `app/assets/javascripts`\n- `app/assets/images`\n- `app/components`\n- `config/locales`\n\nThe gem detects if you use [`jsbundling-rails`](https://github.com/rails/jsbundling-rails) or [`cssbundling-rails`](https://github.com/rails/cssbundling-rails) and watches for changes in their output folder `app/assets/builds` automatically.\n\n### Listen paths\n\nYou can watch for changes in additional folders by adding them to `listen_paths`:\n```ruby\n# config/environments/development.rb\n\nRails.application.configure do\n  # ...\n  config.hotwire_livereload.listen_paths \u003c\u003c Rails.root.join(\"app/custom_folder\")\nend\n```\n\nYou can skip one or few default listen paths:\n```ruby\n# config/environments/development.rb\n\nRails.application.configure do\n  # ...\n  config.hotwire_livereload.skip_listen_paths \u003c\u003c Rails.root.join(\"app/views\")\nend\n```\n\nYou can disable default listen paths and fully override them:\n```ruby\n# config/environments/development.rb\n\nRails.application.configure do\n  # ...\n  config.hotwire_livereload.disable_default_listeners = true\n  config.hotwire_livereload.listen_paths = [\n    Rails.root.join(\"app/assets/stylesheets\"),\n    Rails.root.join(\"app/javascript\")\n  ]\nend\n```\n\n### Force reload\n\nIf you don't have `data-turbo-track=\"reload\"` attribute on your JS and CSS bundles you might need to setup force reloading. This will trigger full browser reloading for JS and CSS files only:\n```ruby\n# config/environments/development.rb\n\nRails.application.configure do\n  # ...\n  config.hotwire_livereload.force_reload_paths \u003c\u003c Rails.root.join(\"app/assets/stylesheets\")\n  config.hotwire_livereload.force_reload_paths \u003c\u003c Rails.root.join(\"app/javascript\")\nend\n```\n\n### Reload method\n\nInstead of a direct ActionCable websocket connection, you can reuse the existing TurboStream websocket connection and send updates using standard turbo-streams:\n```ruby\n# config/environments/development.rb\n\nRails.application.configure do\n  # ...\n  config.hotwire_livereload.reload_method = :turbo_stream\nend\n```\n\n### Listen options\n\n[Listen gem](https://github.com/guard/listen), which is used for file system monitoring, accepts [options](https://github.com/guard/listen?tab=readme-ov-file#options) like enabling a fallback mechanism called \"polling\" to detect file changes.\n\nBy default, Listen uses a more efficient mechanism called \"native\" which relies on the operating system's file system events to detect changes. However, in some cases, such as when working with network-mounted file systems or in certain virtualized environments, the native mechanism may not work reliably. In such cases, enabling force_polling ensures that file changes are still detected, albeit with a slightly higher resource usage.\n\nYou may use listen_options to pass these options like:\n```ruby\n# config/environments/development.rb\n\nRails.application.configure do\n  # ...\n  config.hotwire_livereload.listen_options[:force_polling] = true\nend\n```\n\n### Listen debounce delay\n\nIf your app uses TailwindCSS or similar that compiles your CSS from looking at your templates, you can end up in a situation, where updating a template triggers twice for changes; once for the template and once for the rebuilt CSS. This can lead to unreliable reloads, ie. the reload happening before the CSS is built.\n\nTo avoid this, you can add a debounce delay to the file watcher:\n\n```ruby\n# config/environments/development.rb\n\nRails.application.configure do\n  # ...\n  config.hotwire_livereload.debounce_delay_ms = 300 # in milliseconds\nend\n```\n\n## Disable livereload\n\nTo temporarily disable livereload use:\n```bash\nbin/rails livereload:disable\n```\n\nTo re-enable:\n```bash\nbin/rails livereload:enable\n```\n\nNo server restart is required. Disabling is managed by `tmp/livereload-disabled.txt` file.\n\n## Development\n\nTo get started:\n\n1. Run `npm install`\n2. Run `npm run watch`\n\n## License\n\nHotwire::Livereload is released under the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirillplatonov%2Fhotwire-livereload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkirillplatonov%2Fhotwire-livereload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirillplatonov%2Fhotwire-livereload/lists"}