View Source Phoenix.Copy (Phoenix.Copy v0.1.2)

Copy static assets for your Phoenix app during development and deployment.

For more information, see the README.

direct-usage

Direct Usage

To copy files once, use run/1 with the name of the configured profile(s):

run(:default)
run([:default, :assets])

To watch for changes and continually copy files, use watch/1:

watch(:default)
watch([:default, :assets])

Note that watch/1 will block execution.

Link to this section Summary

Functions

Returns the configuration of the given profile.

Copies files from the configured source and destination for the given profile.

Watch for changes in the configured source and copy files to the destination.

Link to this section Functions

@spec config_for!(atom()) :: Keyword.t()

Returns the configuration of the given profile.

Link to this function

run(profile \\ :default)

View Source
@spec run(atom()) :: [binary()]

Copies files from the configured source and destination for the given profile.

Returns a list of copied files.

Link to this function

watch(profile \\ :default)

View Source
@spec watch(profile :: atom()) :: term()
@spec watch(profiles :: [atom()]) :: term()

Watch for changes in the configured source and copy files to the destination.

Also performs an initial copy of the files immediately. Note that this function blocks execution until the process receives an exit signal.

If multiple profiles are given, the watcher will watch all of the source directories and react according to the file's closest watched ancestor. This means that watched directories may overlap, with nested sources sending their files to different locations than their ancestors.

An optional debounce time can be configured (in milliseconds) to avoid copying the same file multiple times in a short period. By default, a copy will occur for every filesystem event.