---
title: "Discussion on \"Phoenix 1.6.0 LiveView + esbuild + Tailwind JIT + AlpineJS - A brief tutorial.\" | Hashnode"
description: "Discussion on \"Phoenix 1.6.0 LiveView + esbuild + Tailwind JIT + AlpineJS - A brief tutorial.\". Phoenix 1.6.0 is nearing release, and when it comes out it will ditch Webpack for esbuild. It's a smaller integration, more predictable and just more productive.\nThere's very little material out there describing how to set up a liveview, tailwind jit..."
url: "https://hashnode.com/posts/phoenix-160-liveview-esbuild-tailwind-jit-alpinejs-a-brief-tutorial/611867c1ac5c985f36434330"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Phoenix 1.6.0 LiveView + esbuild + Tailwind JIT + AlpineJS - A brief tutorial.](https://sergiotapia.com/phoenix-160-liveview-esbuild-tailwind-jit-alpinejs-a-brief-tutorial?utm_source=hashnode&utm_medium=feed)

Phoenix 1.6.0 is nearing release, and when it comes out it will ditch Webpack for esbuild. It's a smaller integration, more predictable and just more productive. There's very little material out there describing how to set up a liveview, tailwind jit...

Aug 15, 2021 · 4 min read · sergiotapia.com  
Updated Nov 10, 2021  
Read the article

-   [#phoenix](https://hashnode.com/tag/phoenix)
-   [#tailwind-css](https://hashnode.com/tag/tailwind-css)
-   [#elixir](https://hashnode.com/tag/elixir)

## Written by

[Sergio Tapia](https://hashnode.com/@sergiotapia)

@sergiotapia · Miami

  
[View profile](https://hashnode.com/@sergiotapia)

CTO | VP of Engineering | Elixir and Phoenix Liveview

I write open source software, check my Github! Ping me for collabs

## Responses 9

Markdown supported · ⌘↵ to post

[Pau Riosa](https://hashnode.com/@pauriosa)

[Jun 6, 2022](https://hashnode.com/posts/phoenix-160-liveview-esbuild-tailwind-jit-alpinejs-a-brief-tutorial/611867c1ac5c985f36434330/comment/629df91f549bbf502bf4c756)

Thank you for this one Sergio!

[Sergio Tapia](https://hashnode.com/@sergiotapia)

[Aug 31, 2022](https://hashnode.com/posts/phoenix-160-liveview-esbuild-tailwind-jit-alpinejs-a-brief-tutorial/611867c1ac5c985f36434330/comment/629df91f549bbf502bf4c756#reply-630f712956df9e8e502596a2)

Pau! Of course man hope it helped you out, there is a cleaner way out officially from Phoenix, I need to update this article.

[joi mann](https://hashnode.com/@joimann)

[Feb 15, 2022](https://hashnode.com/posts/phoenix-160-liveview-esbuild-tailwind-jit-alpinejs-a-brief-tutorial/611867c1ac5c985f36434330/comment/620b2ae94e82f0219d8fa860)

Thanks Sergio, this helped me a lot. I created a script to do all the above steps automatically.

[script at gitlab](https://gitlab.com/joi.mann/tooling)

[Chorn Sokun](https://hashnode.com/@sokun)

[Nov 13, 2021](https://hashnode.com/posts/phoenix-160-liveview-esbuild-tailwind-jit-alpinejs-a-brief-tutorial/611867c1ac5c985f36434330/comment/618f157e26d4d237c427823f)

I've got tailwindcss ^2.2.19 when I setup my project. I notice that jit didn't work. The output app.css size is 4 MB. I had to add `--jit` to my watch command:

```
    npx: [
      "tailwindcss",
      "--input=css/app.css",
      "--output=../priv/static/assets/app.css",
      "--postcss",
      "--watch",
      "--jit",
      cd: Path.expand("../assets", __DIR__)
    ],
```

[Praveen Angyan](https://hashnode.com/@Genie1978)

[Nov 10, 2021](https://hashnode.com/posts/phoenix-160-liveview-esbuild-tailwind-jit-alpinejs-a-brief-tutorial/611867c1ac5c985f36434330/comment/618b44bcf991b025366e05e3)

This section:

```
    npx: [
      "tailwindcss",
      "--input=css/app.css",
      "--output=../priv/static/assets/app.css",
      "--postcss",
      "--watch",
      cd: Path.expand("../assets", __DIR__)
    ]
```

causes Google Chrome to crash with an Aw Snap message. I'm using WSL 2 with Windows 10 and I can see Live reload reloading the app.css many, many times.

[Sergio Tapia](https://hashnode.com/@sergiotapia)

[Nov 10, 2021](https://hashnode.com/posts/phoenix-160-liveview-esbuild-tailwind-jit-alpinejs-a-brief-tutorial/611867c1ac5c985f36434330/comment/618b44bcf991b025366e05e3#reply-618be3d8468c06249afc67ec)

Unfortunately I don't use Windows - it probably has something to do with the file observer setup.

[Jimmy Bosse](https://hashnode.com/@jbosse)

[Nov 8, 2021](https://hashnode.com/posts/phoenix-160-liveview-esbuild-tailwind-jit-alpinejs-a-brief-tutorial/611867c1ac5c985f36434330/comment/61898411710d816e7a9cdd2b)

For anyone coming here and using Alpine 3.5 or later, you also need to modify your `config.exs` to change the `config :esbuild` section from `--target=es2016` to `--target=es2017` as Alpine no longer supports transpiring to es2016.

[Jason Jones](https://hashnode.com/@Jason31415)

[Oct 16, 2021](https://hashnode.com/posts/phoenix-160-liveview-esbuild-tailwind-jit-alpinejs-a-brief-tutorial/611867c1ac5c985f36434330/comment/616b5ebe441bd36daa9560a7)

Thanks for putting this together. I'm stumped on the alpine stuff. I've npm installed it and added the setup code to "assets/js/japp.js" (via a statement like import "alpinejs" and the rest of the config snipped from the article), but the only way I can get Alpine to work is if I also load it directly into the layout html via

```
 <script defer src="unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
```

then it works. If I comment that script tag out, then no go. Any tips for what I might be missing? Thanks!

[Sergio Tapia](https://hashnode.com/@sergiotapia)

[Nov 10, 2021](https://hashnode.com/posts/phoenix-160-liveview-esbuild-tailwind-jit-alpinejs-a-brief-tutorial/611867c1ac5c985f36434330/comment/616b5ebe441bd36daa9560a7#reply-618be37bf991b025366e153d)

Hey [Jason Jones](https://hashnode.com/@Jason31415) I recommend checking out the source code link and compare to what you have. That would be your easiest bet.

[Scribe of the Ziggurat](https://hashnode.com/@steveoc64)

[Aug 29, 2021](https://hashnode.com/posts/phoenix-160-liveview-esbuild-tailwind-jit-alpinejs-a-brief-tutorial/611867c1ac5c985f36434330/comment/612bfcd6fd0bf8636d76e6f7)

Excellent and straight to the point - thanks.

Im having issues with app.js - the part where its assigning

```
hooks: hooks,
```

Is throwing a js error "hooks is not defined"

just trying to debug that today.

[Scribe of the Ziggurat](https://hashnode.com/@steveoc64)

[Aug 29, 2021](https://hashnode.com/posts/phoenix-160-liveview-esbuild-tailwind-jit-alpinejs-a-brief-tutorial/611867c1ac5c985f36434330/comment/612bfcd6fd0bf8636d76e6f7#reply-612c0583fd0bf8636d76e748)

just declaring an empty hooks seemed to fix it all up

```
let hooks = {};
```

[Sergio Tapia](https://hashnode.com/@sergiotapia)

[Aug 30, 2021](https://hashnode.com/posts/phoenix-160-liveview-esbuild-tailwind-jit-alpinejs-a-brief-tutorial/611867c1ac5c985f36434330/comment/612bfcd6fd0bf8636d76e6f7#reply-612d052f2858872661b9e2fa)

You're right! [Scribe of the Ziggurat](https://hashnode.com/@steveoc64)

I had that in my code but forgot to update the article, it's all fixed. Thank you!

[Florin](https://hashnode.com/@alchemist-wannabe)

[Aug 15, 2021](https://hashnode.com/posts/phoenix-160-liveview-esbuild-tailwind-jit-alpinejs-a-brief-tutorial/611867c1ac5c985f36434330/comment/611954c7ac5c985f36436651)

Just to confirm, your project works on OSX (BigSur) on an M1 chip, and having the following:

-   asdf: v0.8.1-a1ef92a
-   elixir 1.12.2
-   erlang 24.0.2
-   nodejs 16.6.2

_So glad there is hope to never needing again to deal with node-sass, webpack and other similar ... "life improving" tools._

[Florin](https://hashnode.com/@alchemist-wannabe)

[Aug 15, 2021](https://hashnode.com/posts/phoenix-160-liveview-esbuild-tailwind-jit-alpinejs-a-brief-tutorial/611867c1ac5c985f36434330/comment/61195078888ca15f5d38be8f)

thank you for the writeup. Can you please add a few more details about how you generated the phx project (did you use phx 1.6 or was it created by hand and 1.6 was added after?!) and also what nodejs version is used, if you don't mind? Thank you!

_(will try your project on osx m1, with asdf and report back)_

[Sergio Tapia](https://hashnode.com/@sergiotapia)

[Aug 16, 2021](https://hashnode.com/posts/phoenix-160-liveview-esbuild-tailwind-jit-alpinejs-a-brief-tutorial/611867c1ac5c985f36434330/comment/61195078888ca15f5d38be8f#reply-611a820dac5c985f36439313)

Yes, this project was generated using Phoenix 1.6.0-dev, built from latest `master` branch. Phoenix 1.6.0 is not out yet but I wanted to benefit from the new auth generators and esbuild.

Here's how you can generate your own Phoenix 1.6.0 project: [github.com/phoenixframework/phoenix](https://github.com/phoenixframework/phoenix#generating-a-phoenix-project-from-unreleased-versions)
