### Install Tailwind Binary Source: https://github.com/phoenixframework/tailwind/blob/main/README.md Run this mix task to install the Tailwind CSS binary. The executable will be located at `_build/tailwind-TARGET`. ```bash $ mix tailwind.install ``` -------------------------------- ### Install Tailwind CLI from npm Source: https://github.com/phoenixframework/tailwind/blob/main/README.md Install Tailwind CSS and related packages as development dependencies in the `assets/` directory using npm. ```bash $ npm i --prefix assets -D tailwindcss @tailwindcss/cli daisyui ``` -------------------------------- ### Install Tailwind with Custom Path Source: https://github.com/phoenixframework/tailwind/blob/main/README.md If your platform is not officially supported, you can provide a URL to a third-party Tailwind binary. Compatibility is not guaranteed. ```bash $ mix tailwind.install https://people.freebsd.org/~dch/pub/tailwind/v3.2.6/tailwindcss-freebsd-x64 ``` -------------------------------- ### Invoke Tailwind Task Source: https://github.com/phoenixframework/tailwind/blob/main/README.md Execute the default Tailwind task. This command invokes the installed Tailwind CSS binary. ```bash $ mix tailwind default ``` -------------------------------- ### Configure Tailwind Path for npm Source: https://github.com/phoenixframework/tailwind/blob/main/README.md Update `config/config.exs` to point to the Tailwind CSS executable found in your `assets/node_modules/.bin/` directory when using the npm installation. ```diff config :tailwind, + version_check: false, + path: Path.expand("../assets/node_modules/.bin/tailwindcss", __DIR__), ... ``` -------------------------------- ### Configure assets.deploy in mix.exs Source: https://github.com/phoenixframework/tailwind/blob/main/README.md Include Tailwind in the `assets.deploy` alias for deployments, using the `--minify` option. ```elixir "assets.deploy": ["tailwind default --minify", ..., "phx.digest"] ``` -------------------------------- ### Adjust Configuration for Tailwind v4 (v3 to v4) Source: https://github.com/phoenixframework/tailwind/blob/main/README.md Illustrates the configuration changes in `config.exs` when migrating from Tailwind v3 to v4, including version, input, output, and `cd` path. ```diff config :tailwind, - version: "3.4.13", + version: "4.1.12", default: [ args: ~w( - --config=tailwind.config.js - --input=css/app.css - --output=../priv/static/assets/app.css + --input=assets/css/app.css + --output=priv/static/assets/css/app.css ), - cd: Path.expand("../assets", __DIR__) + cd: Path.expand("..", __DIR__) ] ``` -------------------------------- ### Enable Watch Mode in config/dev.exs Source: https://github.com/phoenixframework/tailwind/blob/main/README.md Configure the `watchers` in `config/dev.exs` to enable Tailwind's file system watcher for development. ```elixir tailwind: {Tailwind, :install_and_run, [:default, ~w(--watch)]} ``` -------------------------------- ### Create app.css with Tailwind Directives Source: https://github.com/phoenixframework/tailwind/blob/main/README.md Define the `assets/css/app.css` file using Tailwind CSS v4 directives for importing and custom variants. ```css @import "tailwindcss" source(none); @source "../css"; @source "../js"; @source "../../lib/YOUR_APP_web"; @custom-variant phx-click-loading (.phx-click-loading&, .phx-click-loading &); @custom-variant phx-submit-loading (.phx-submit-loading&, .phx-submit-loading &); @custom-variant phx-change-loading (.phx-change-loading&, .phx-change-loading &); ``` -------------------------------- ### Add Tailwind Dependency to mix.exs Source: https://github.com/phoenixframework/tailwind/blob/main/README.md Add the Tailwind package as a dependency in your `mix.exs` file for Phoenix applications. ```elixir def deps do [ {:phoenix, "~> 1.8"}, {:tailwind, ">~ 0.3", runtime: Mix.env() == :dev} ] end ``` -------------------------------- ### Update Tailwind Imports in app.css (v3 to v4) Source: https://github.com/phoenixframework/tailwind/blob/main/README.md Shows the `diff` for updating Tailwind CSS imports in `app.css` when migrating from v3 to v4. ```diff -@import "tailwindcss/base"; -@import "tailwindcss/components"; -@import "tailwindcss/utilities"; +@import "tailwindcss"; ``` -------------------------------- ### Add Tailwind Dependency Source: https://github.com/phoenixframework/tailwind/blob/main/README.md Add `tailwind` as a dependency in your `mix.exs` file. Set `runtime: Mix.env() == :dev` to ensure it only runs in development environments. ```elixir def deps do [ {:tailwind, "~> 0.3", runtime: Mix.env() == :dev} ] end ``` -------------------------------- ### Update CSS Plugin Paths for npm Source: https://github.com/phoenixframework/tailwind/blob/main/README.md Adjust the `@plugin` paths in `assets/css/app.css` to use relative paths when Tailwind CSS is managed via npm. ```diff -@plugin "../vendor/daisyui" { +@plugin "daisyui" { ... -@plugin "../vendor/daisyui-theme" { +@plugin "daisyui/theme" { ``` -------------------------------- ### Update Tailwind Dependency (v3 to v4) Source: https://github.com/phoenixframework/tailwind/blob/main/README.md Shows the `diff` for updating the Tailwind dependency from v0.2 to v0.3 in `mix.exs`. ```diff defp deps do [ - {:tailwind, ">~ 0.2", runtime: Mix.env() == :dev}, + {:tailwind, ">~ 0.3", runtime: Mix.env() == :dev}, ] end ``` -------------------------------- ### Configure Tailwind for Umbrella Projects Source: https://github.com/phoenixframework/tailwind/blob/main/README.md For umbrella Phoenix projects, specify the web application's asset directory in the Tailwind configuration. ```elixir config :tailwind, version: "4.1.12", default: [ args: ..., cd: Path.expand("../apps/", __DIR__) ] ``` -------------------------------- ### Configure Tailwind Version Source: https://github.com/phoenixframework/tailwind/blob/main/README.md Specify the Tailwind CSS version in your `config/config.exs` file. Versions 0.3+ default to Tailwind v4+, but v3 is also supported with potential configuration differences. ```elixir config :tailwind, version: "4.1.12" ``` -------------------------------- ### Define Tailwind Execution Profile Source: https://github.com/phoenixframework/tailwind/blob/main/README.md Configure custom execution profiles for the `tailwind` mix task in `config/config.exs`. This allows setting default arguments, working directory, and environment variables for different Tailwind invocations. ```elixir config :tailwind, version: "4.1.12", default: [ args: ~w( --input=assets/css/app.css --output=priv/static/assets/css/app.css ), cd: Path.expand("..", __DIR__) ] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.