{"id":23177626,"url":"https://github.com/aj-foster/phx_copy","last_synced_at":"2025-08-18T11:32:55.627Z","repository":{"id":43914312,"uuid":"472982185","full_name":"aj-foster/phx_copy","owner":"aj-foster","description":"Copy assets in your Phoenix app","archived":false,"fork":false,"pushed_at":"2024-06-05T16:40:35.000Z","size":63,"stargazers_count":9,"open_issues_count":1,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-08-09T11:12:26.983Z","etag":null,"topics":["elixir","phoenix"],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/aj-foster.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","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},"funding":{"github":["aj-foster"]}},"created_at":"2022-03-23T00:25:20.000Z","updated_at":"2024-06-14T09:13:43.000Z","dependencies_parsed_at":"2024-06-05T18:46:47.576Z","dependency_job_id":null,"html_url":"https://github.com/aj-foster/phx_copy","commit_stats":{"total_commits":37,"total_committers":3,"mean_commits":"12.333333333333334","dds":0.05405405405405406,"last_synced_commit":"f989243b8e1bba7be1093e159db73ae6954c98c3"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aj-foster%2Fphx_copy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aj-foster%2Fphx_copy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aj-foster%2Fphx_copy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aj-foster%2Fphx_copy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aj-foster","download_url":"https://codeload.github.com/aj-foster/phx_copy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230228027,"owners_count":18193413,"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":["elixir","phoenix"],"created_at":"2024-12-18T06:35:55.310Z","updated_at":"2024-12-18T06:35:56.089Z","avatar_url":"https://github.com/aj-foster.png","language":"Elixir","funding_links":["https://github.com/sponsors/aj-foster"],"categories":[],"sub_categories":[],"readme":"# Phoenix Copy\n\n[![Hex.pm](https://img.shields.io/hexpm/v/phoenix_copy)](https://hex.pm/packages/phoenix_copy)\n[![Documentation](https://img.shields.io/badge/hex-docs-blue)](https://hexdocs.pm/phoenix_copy)\n[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)\n\nCopy static assets for your Phoenix app during development and deployment.\n\nThis project provides:\n\n* A mix task `mix phx.copy` for one-time copying of files during deployment\n* Integration with Phoenix watchers to provide continuous copying of files in development\n* The ability to configure multiple sources and destinations for more complex workflows\n\nIt pairs nicely with the Phoenix team's [esbuild](https://github.com/phoenixframework/esbuild) and [tailwind](https://github.com/phoenixframework/tailwind) helpers for a complete asset pipeline.\n\n## Installation\n\nIf you plan to copy assets in production, then add `phoenix_copy` as a dependency in all environments:\n\n```elixir\ndef deps do\n  [\n    {:phoenix_copy, \"~\u003e 0.1.4\"}\n  ]\nend\n```\n\nOn the other hand, if you only need to copy assets in development, you can install it as a `dev` dependency only:\n\n```elixir\ndef deps do\n  [\n    {:phoenix_copy, \"~\u003e 0.1.3\", only: :dev}\n  ]\nend\n```\n\nAfter installation, `phoenix_copy` requires some configuration.\n\n## Configuration\n\nThis project uses configuration _profiles_ to allow multiple configurations with the same package.\nTo get started, let's create a profile called `default` in the app's configuration:\n\n```elixir\nconfig :phoenix_copy,\n  default: [\n    source: Path.expand(\"../assets/static/\", __DIR__),\n    destination: Path.expand(\"../priv/static/\", __DIR__),\n    debounce: 100\n  ],\n```\n\nIn this example, files will be copied from `../assets/static/` to `../priv/static/`, two directories relative to the location of the configuration file.\nBy using `Path.expand(..., __DIR__)`, we can be sure that the paths won't change depending on the working directory of the caller.\n\n`debounce` is an optional time in milliseconds to wait before executing the copy.\nMultiple file changes made within the debounce period will result in a single copy event.\n\nIf you need multiple copies to take place, you can add additional profiles:\n\n```elixir\nconfig :phoenix_copy,\n  images: [\n    source: Path.expand(\"../assets/static/images/\", __DIR__),\n    destination: Path.expand(\"../priv/static/images/\", __DIR__)\n  ],\n  docs: [\n    source: Path.expand(\"../docs/\", __DIR__),\n    destination: Path.expand(\"../priv/static/docs/\", __DIR__),\n    debounce: 100\n  ]\n```\n\n## Usage\n\nFor **one-time copying** of files — for example, when preparing assets for deployment — use `mix phx.copy [profile] [profile2] ...` with the name of the configuration profiles.\nThis can integrate with a mix alias for ease-of-use (for example, in `mix.exs`):\n\n```elixir\ndefp aliases do\n  [\n    \"assets.deploy\": [\n      \"phx.copy default\",\n      \"esbuild default --minify\",\n      \"tailwind default --minify\",\n      \"phx.digest\"\n    ],\n    # ...\n  ]\nend\n```\n\nFor **continuous copying** of files — for example, in development — use `Phoenix.Copy` and the `watch/1` function with the name of the configuration profile.\nThis can integration with Phoenix endpoint configuration for ease-of-use (for example, in `dev.exs`):\n\n```elixir\nconfig :my_app, MyAppWeb.Endpoint,\n  http: [port: 4000],\n  # ...\n  watchers: [\n    asset_copy: {Phoenix.Copy, :watch, [:default]},\n    esbuild: {Esbuild, :install_and_run, [:default, ~w(--sourcemap=inline --watch)]},\n    tailwind: {Tailwind, :install_and_run, [:default, ~w(--watch)]}\n  ]\n```\n\nFor continuously copying multiple profiles at once, use `{Phoenix.Copy, :watch, [[:profile1, :profile2, ...]]}`.\n\n## Acknowledgements\n\nThis project uses code adapted from the [esbuild](https://github.com/phoenixframework/esbuild) and [tailwind](https://github.com/phoenixframework/tailwind) helpers for Phoenix.\nThose projects, like this one, are licensed under the [MIT License](LICENSE).\nThank you to the contributors of both projects.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faj-foster%2Fphx_copy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faj-foster%2Fphx_copy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faj-foster%2Fphx_copy/lists"}