Closed voidFunctionReturn0 closed 3 months ago
You shouldn’t need node or a package.json file for a new Phoenix project.
mix phx.new
with the default options should configure esbuild
At the end of the file creation process, the script asks if you want to install dependencies which should run mix assets.setup
which installs tailwindcss and esbuild
From there mix ecto.create
and mix phx.server
should be all you need.
I suggest removing your package.json and running mix assets.setup
and try from there.
I suspect you opened the page before the assets had finished building. I'm going to close this issue, but feel free to re-open if it persists.
Environment
Actual behavior
I created a Phoenix project with the “phx.new my_app” command.
When I run the Phoenix app with the “mix phx.server” command, the CSS is not applied. In the ‘priv/static/assets’ folder, there is only an ‘app.js’ file and no ‘app.css’ file.
Expected behavior
I solved the problem in the following way.
{ "name": "my_app", "version": "1.0.0", "description": "", "main": "js/app.js", "scripts": { "deploy": "NODE_ENV=production tailwindcss -o ../priv/static/assets/app.css" }, "dependencies": { "@tailwindcss/forms": "^0.5.7", "tailwindcss": "^3.4.3" } }