{"id":16395770,"url":"https://github.com/praveenperera/gleam_compile","last_synced_at":"2025-03-21T02:32:27.484Z","repository":{"id":62429820,"uuid":"278980152","full_name":"praveenperera/gleam_compile","owner":"praveenperera","description":"Tiny hex package to make the development experience of using gleam in elixir (and especially phoenix projects) better.","archived":false,"fork":false,"pushed_at":"2022-02-21T13:12:44.000Z","size":483,"stargazers_count":28,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-16T00:41:51.548Z","etag":null,"topics":["autoreload","elixir","gleam","hex","phoenix"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/praveenperera.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2020-07-12T02:57:08.000Z","updated_at":"2023-09-27T21:28:25.000Z","dependencies_parsed_at":"2022-11-01T20:05:34.690Z","dependency_job_id":null,"html_url":"https://github.com/praveenperera/gleam_compile","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/praveenperera%2Fgleam_compile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praveenperera%2Fgleam_compile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praveenperera%2Fgleam_compile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praveenperera%2Fgleam_compile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/praveenperera","download_url":"https://codeload.github.com/praveenperera/gleam_compile/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244725588,"owners_count":20499633,"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":["autoreload","elixir","gleam","hex","phoenix"],"created_at":"2024-10-11T05:05:34.874Z","updated_at":"2025-03-21T02:32:27.009Z","avatar_url":"https://github.com/praveenperera.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg alt=\"GleamCompile\" src=\"https://praveenperera.github.io/gleam_compile/logo.svg\" height=\"50px\"\u003e\u003c/img\u003e\u003c/p\u003e\n\u003cp align=\"center\"\u003eElixir + Gleam = ❤️ \u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://hex.pm/packages/gleam_compile\"\u003e\u003cimg alt=\"Hex.pm\" src=\"https://img.shields.io/hexpm/l/gleam_compile\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://hex.pm/packages/gleam_compile\"\u003e\u003cimg alt=\"Hex.pm\" src=\"https://img.shields.io/hexpm/v/gleam_compile\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://hex.pm/packages/gleam_compile\"\u003e\u003cimg alt=\"Hex.pm\" src=\"https://img.shields.io/hexpm/dt/gleam_compile\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://hexdocs.pm/gleam_compile\"\u003e\u003cimg alt=\"HexDocs.pm\" src=\"https://img.shields.io/badge/hex-docs-purple.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n## Description\n\nA tiny hex package makes it easier to use [gleam](https://github.com/gleam-lang/gleam) in elixir and phoenix projects\n\nThis package does two things\n\n1. Runs the gleam compiler\n2. In development it automatically reloads the gleam files when recompiled\n\n**Demo with Phoenix Live Reload**\n\n\u003cimg src=\"https://praveenperera.github.io/gleam_compile/demo.gif?raw=true\" alt=\"Explainer\" width=\"750px\"\u003e\n\n## Installation\n\n**_Note: Make sure [gleam is already installed on your system](https://gleam.run/getting-started/installing-gleam.html)._**\n\nThis package is available on [hex](https://hex.pm/packages/gleam_compile).\n\n1. The package can be installed by adding `gleam_compile` to your list of dependencies in `mix.exs`:\n\n   ```elixir\n   def deps do\n     [\n       {:gleam_compile, \"~\u003e 0.2.0\"}\n     ]\n   end\n   ```\n\n2. Add `:gleam` to list of compilers, and the gleam folders to the `erlc_paths`\n   in your `mix.exs`\n\n   ```diff\n   def project do\n     [\n      app: :jib,\n      version: \"0.1.0\",\n      elixir: \"~\u003e 1.5\",\n      elixirc_paths: elixirc_paths(Mix.env()),\n   +  erlc_paths: [\"src\", \"gen\"],\n   +  compilers: [:gleam] ++ Mix.compilers(),\n      start_permanent: Mix.env() == :prod,\n      releases: releases(),\n      aliases: aliases(),\n      deps: deps()\n     ]\n   end\n   ```\n\n## Integrating with Phoenix Live Reloader\n\n1. Add `:gleam` to list of compilers in your `mix.exs`\n\n   ```elixir\n   compilers: [:phoenix, :gettext, :gleam] ++ Mix.compilers()\n   ```\n\n   ```diff\n     def project do\n    [\n      app: :jib,\n      version: \"0.1.0\",\n      elixir: \"~\u003e 1.5\",\n      elixirc_paths: elixirc_paths(Mix.env()),\n      erlc_paths: [\"src\", \"gen\"],\n   -  compilers: [:phoenix, :gettext] ++ Mix.compilers(),\n   +  compilers: [:phoenix, :gettext, :gleam] ++ Mix.compilers(),\n      start_permanent: Mix.env() == :prod,\n      releases: releases(),\n      aliases: aliases(),\n      deps: deps()\n    ]\n   end\n   ```\n\n2. In `dev.exs` add this line in the `Endpoint` config\n\n   ```elixir\n   reloadable_compilers: [:gettext, :phoenix, :elixir, :gleam],\n   ```\n\n   ```diff\n   config :my_app, MyAppWeb.Endpoint,\n     http: [port: 4000],\n     debug_errors: true,\n     code_reloader: true,\n     check_origin: false,\n   + reloadable_compilers: [:gettext, :phoenix, :elixir, :gleam],\n     watchers: [\n       node: [\n         \"node_modules/webpack/bin/webpack.js\",\n         \"--mode\",\n         \"development\",\n         \"--watch-stdin\",\n         cd: Path.expand(\"../assets\", __DIR__)\n       ]\n     ]\n   ```\n\n3. Add gleam files to the live_reload patterns\n\n   ```elixir\n   ~r\"src/.*(gleam)$\",\n   ```\n\n   ```diff\n   config :my_app, MyAppWeb.Endpoint,\n     live_reload: [\n       patterns: [\n         ~r\"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$\",\n         ~r\"priv/gettext/.*(po)$\",\n   +     ~r\"src/.*(gleam)$\",\n         ~r\"lib/jib_web/{live,views}/.*(ex)$\",\n         ~r\"lib/jib_web/templates/.*(eex)$\"\n       ]\n     ]\n   ```\n\n## Acknowledgements\n\n- [Mixing Gleam \u0026 Elixir](https://dev.to/contact-stack/mixing-gleam-elixir-3fe3) – by [Michael Jones](https://twitter.com/michaelpjones)\n- [Louis](https://twitter.com/louispilfold) (creator of gleam) for [talking me through the process](https://twitter.com/PraveenPerera/status/1281696372954206208) and [helping with debugging](https://twitter.com/PraveenPerera/status/1281692313308340225)\n\n## License\n\nGleamCompile is released under the Apache License 2.0 - see the [LICENSE](LICENSE.md) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpraveenperera%2Fgleam_compile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpraveenperera%2Fgleam_compile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpraveenperera%2Fgleam_compile/lists"}