README.md

# Manifester [![hex.pm](https://img.shields.io/hexpm/v/manifester.svg?style=flat-square)](https://hex.pm/packages/manifester) [![hexdocs.pm](https://img.shields.io/badge/docs-latest-green.svg?style=flat-square)](https://hexdocs.pm/manifester)

A simple tool for fetching digested asset names at runtime (generated by `mix phx.digest`).

Implemented as a GenServer so it caches the manifest in memory.

## Installation

Add to your `mix.exs`:

```elixir
def deps do
  [
    {:manifester, "~> 1.0"}
  ]
end
```

If you're not using [application inference](https://elixir-lang.org/blog/2017/01/05/elixir-v1-4-0-released/#application-inference), then add `:manifester` to your `applications` list.

## Usage

Add the `Manifester` GenServer to you supervision tree, ideally at the top:

```elixir
# Define workers and child supervisors to be supervised
children = [
  Manifester, # or worker(Manifester, [])
  # Repo, Endpoint...
]
```

and set your application name in `config.exs`:

```elixir
config :manifester, otp_app: :myapp
```

Replace `:myapp` with your application name.

Now you're good to go!

`Manifester` assumes there is a `cache_manifest.json` generated
in `./priv/static/` (which is default in Phoenix). If one is available, you can grab
the digested asset name like so:

```elixir
iex> Manifester.get("js/app.js")
"js/app-53ddc50a336555354d6b3d18b76d8af6.js"
```

You can use it to generate full URLs when using a CDN or for something else.

## About

<img src="http://cdn.heresy.io/media/logo.png" alt="Heresy logo" width=300>

This project is sponsored by [Heresy](http://heresy.io). We're always looking for great engineers to join our team, so if you love Elixir, open source and enjoy some challenge, drop us a line and say hello!

## License

* Manifester: See LICENSE file.
* "Heresy" name and logo: Copyright © 2018 Heresy Software Ltd