roflbobl

roflbobl

Phoenix - Tailwindcss wont produce CSS classes

Hello,

I have a problem in my project i can’t seem to solve. Tailwind will not produce the classes i write. So when i change a class to something i have not used before, no class will be generated and shipped to the frontend.

The hot-reloading is working, as the application updates when i change something and save.

Here is my config.exs

config :esbuild,
  version: "0.17.11",
  default: [
    args:
      ~w(js/app.js --bundle --target=es2017 --loader:.js=jsx --outdir=../priv/static/assets --external:/fonts/* --external:/images/*),
    cd: Path.expand("../assets", __DIR__),
    env: %{"NODE_PATH" => Path.expand("../deps", __DIR__)}
  ]

config :tailwind,
  version: "3.2.7",
  default: [
    args: ~w(
      --config=tailwind.config.js
      --input=css/app.css
      --output=../priv/static/assets/app.css),
    cd: Path.expand("../assets", __DIR__)
  ],
  email: [
    args: ~w(
        --config=tailwind_email.config.js
        --input=css/app.css
        --output=../priv/static/assets/email_app.css),
    cd: Path.expand("../assets", __DIR__)
  ]

tailwind.config.js:

let plugin = require('tailwindcss/plugin');

module.exports = {
  content: ['./js/**/*.js', '../lib/*_web.ex', '../lib/*_web/**/*.*ex'],
  ... 
}

dev.exs:

config :oceanconnect, OceanconnectWeb.Endpoint,
  http: [ip: {0, 0, 0, 0}, port: System.get_env("PORT") || 4000],
  debug_errors: true,
  code_reloader: true,
  check_origin: false,
  secret_key_base: "iri+y1gpDKiCiXXuj6LYuJh3Fpb0x0rlZvikPZ0iSJFmA2Lrx8W4G0f55nVt1RDR",
  watchers: [
    # Start the esbuild watcher by calling Esbuild.install_and_run(:default, args)
    esbuild: {Esbuild, :install_and_run, [:default, ~w(--sourcemap=inline --watch)]},
    tailwind: {Tailwind, :install_and_run, [:default, ~w(--watch)]},
    tailwind: {Tailwind, :install_and_run, [:email, ~w(--watch)]},
    sass: {
      DartSass,
      :install_and_run,
      [:default, ~w(--embed-source-map --source-map-urls=absolute --watch)]
    }
  ]

Marked As Solved

roflbobl

roflbobl

So the solution was to delete my assets folder. I think the hash wasn’t properly updated after updating tailwind to a newer version

Also Liked

03juan

03juan

I’ve had the same problem before, it happened after I was testing out the assets.deploy task and then running the server in dev mode. The tailwind and esbuild versions weren’t changed at all in this case.

The fix was to run phx.digest.clean --all and also delete the base app.css and js files, basically the same as nuking the whole folder.

scoop

scoop

What happens if you switch to version: 3.2.4 and then run mix tailwind.install?

Where Next?

Popular in Questions Top

JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

Other popular topics Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44265 214
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New

We're in Beta

About us Mission Statement