Skip to content

Commit

Permalink
Reorganize and touch-up Adding to Phoenix section (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
nskins authored Jan 8, 2023
1 parent 5e0e798 commit 6c5f34e
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ to the ones configured above. Note profiles must be configured in your
## Adding to Phoenix

To add `tailwind` to an application using Phoenix, you will need Phoenix v1.6+
and the following four steps.
and the following steps.

First add it as a dependency in your `mix.exs`:

Expand All @@ -93,6 +93,13 @@ def deps do
end
```

Also, in `mix.exs`, add `tailwind` to the `assets.deploy`
alias for deployments (with the `--minify` option):

```elixir
"assets.deploy": ["tailwind default --minify", ..., "phx.digest"]
```

Now let's change `config/config.exs` to tell `tailwind` to use
configuration in `assets/tailwind.config.js` for building our css
bundle into `priv/static/assets`. We'll also give it our `assets/css/app.css`
Expand Down Expand Up @@ -135,16 +142,18 @@ configuration in your `config/dev.exs` and add:

Note we are enabling the file system watcher.

Check you have correctly removed the `import "../css/app.css"` line
in your `assets/js/app.js`.

Finally, back in your `mix.exs`, make sure you have a `assets.deploy`
alias for deployments, which will also use the `--minify` option:
Finally, run the command:

```elixir
"assets.deploy": ["tailwind default --minify", ..., "phx.digest"]
```bash
$ mix tailwind.install
```

This command installs Tailwind and updates your `assets/css/app.css`
and `assets/js/app.js` with the necessary changes to start using Tailwind
right away. It also generates a default configuration file called
`assets/tailwind.config.js` for you. This is the file we referenced
when we configured `tailwind` in `config/config.exs`.

## Tailwind Configuration

The first time this package is installed, a default tailwind configuration
Expand Down

0 comments on commit 6c5f34e

Please sign in to comment.